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 /* Error codes could be pre-Win32 */
36 #define DE_SAMEFILE 0x71
37 #define DE_MANYSRC1DEST 0x72
38 #define DE_DIFFDIR 0x73
39 #define DE_OPCANCELLED 0x75
40 #define DE_DESTSUBTREE 0x76
41 #define DE_INVALIDFILES 0x7C
42 #define DE_DESTSAMETREE 0x7D
43 #define DE_FLDDESTISFILE 0x7E
44 #define DE_FILEDESTISFLD 0x80
45 #define expect_retval(ret, ret_prewin32)\
47 broken(retval == ret_prewin32),\
48 "Expected %d, got %d\n", ret, retval)
50 static CHAR CURR_DIR
[MAX_PATH
];
51 static const WCHAR UNICODE_PATH
[] = {'c',':','\\',0x00c4,'\0','\0'};
52 /* "c:\Ä", or "c:\A" with diaeresis */
53 /* Double-null termination needed for pFrom field of SHFILEOPSTRUCT */
55 static HMODULE hshell32
;
56 static int (WINAPI
*pSHCreateDirectoryExA
)(HWND
, LPCSTR
, LPSECURITY_ATTRIBUTES
);
57 static int (WINAPI
*pSHCreateDirectoryExW
)(HWND
, LPCWSTR
, LPSECURITY_ATTRIBUTES
);
58 static int (WINAPI
*pSHFileOperationW
)(LPSHFILEOPSTRUCTW
);
59 static DWORD_PTR (WINAPI
*pSHGetFileInfoW
)(LPCWSTR
, DWORD
, SHFILEINFOW
*, UINT
, UINT
);
60 static int (WINAPI
*pSHPathPrepareForWriteA
)(HWND
, IUnknown
*, LPCSTR
, DWORD
);
61 static int (WINAPI
*pSHPathPrepareForWriteW
)(HWND
, IUnknown
*, LPCWSTR
, DWORD
);
63 static void InitFunctionPointers(void)
65 hshell32
= GetModuleHandleA("shell32.dll");
66 pSHCreateDirectoryExA
= (void*)GetProcAddress(hshell32
, "SHCreateDirectoryExA");
67 pSHCreateDirectoryExW
= (void*)GetProcAddress(hshell32
, "SHCreateDirectoryExW");
68 pSHFileOperationW
= (void*)GetProcAddress(hshell32
, "SHFileOperationW");
69 pSHGetFileInfoW
= (void*)GetProcAddress(hshell32
, "SHGetFileInfoW");
70 pSHPathPrepareForWriteA
= (void*)GetProcAddress(hshell32
, "SHPathPrepareForWriteA");
71 pSHPathPrepareForWriteW
= (void*)GetProcAddress(hshell32
, "SHPathPrepareForWriteW");
74 /* creates a file with the specified name for tests */
75 static void createTestFile(const CHAR
*name
)
80 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
81 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
82 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
83 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
87 static void createTestFileW(const WCHAR
*name
)
91 file
= CreateFileW(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
92 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file\n");
96 static BOOL
file_exists(const CHAR
*name
)
98 return GetFileAttributesA(name
) != INVALID_FILE_ATTRIBUTES
;
101 static BOOL
dir_exists(const CHAR
*name
)
106 attr
= GetFileAttributesA(name
);
107 dir
= ((attr
& FILE_ATTRIBUTE_DIRECTORY
) == FILE_ATTRIBUTE_DIRECTORY
);
109 return ((attr
!= INVALID_FILE_ATTRIBUTES
) && dir
);
112 static BOOL
file_existsW(LPCWSTR name
)
114 return GetFileAttributesW(name
) != INVALID_FILE_ATTRIBUTES
;
117 static BOOL
file_has_content(const CHAR
*name
, const CHAR
*content
)
123 file
= CreateFileA(name
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, 0, NULL
);
124 if (file
== INVALID_HANDLE_VALUE
)
126 ReadFile(file
, buf
, MAX_PATH
- 1, &read
, NULL
);
129 return strcmp(buf
, content
)==0;
132 /* initializes the tests */
133 static void init_shfo_tests(void)
137 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
138 len
= lstrlenA(CURR_DIR
);
140 if(len
&& (CURR_DIR
[len
-1] == '\\'))
143 createTestFile("test1.txt");
144 createTestFile("test2.txt");
145 createTestFile("test3.txt");
146 createTestFile("test_5.txt");
147 CreateDirectoryA("test4.txt", NULL
);
148 CreateDirectoryA("testdir2", NULL
);
149 CreateDirectoryA("testdir2\\nested", NULL
);
150 createTestFile("testdir2\\one.txt");
151 createTestFile("testdir2\\nested\\two.txt");
154 /* cleans after tests */
155 static void clean_after_shfo_tests(void)
157 DeleteFileA("test1.txt");
158 DeleteFileA("test2.txt");
159 DeleteFileA("test3.txt");
160 DeleteFileA("test_5.txt");
161 DeleteFileA("one.txt");
162 DeleteFileA("test4.txt\\test1.txt");
163 DeleteFileA("test4.txt\\test2.txt");
164 DeleteFileA("test4.txt\\test3.txt");
165 RemoveDirectoryA("test4.txt");
166 DeleteFileA("testdir2\\one.txt");
167 DeleteFileA("testdir2\\test1.txt");
168 DeleteFileA("testdir2\\test2.txt");
169 DeleteFileA("testdir2\\test3.txt");
170 DeleteFileA("testdir2\\test4.txt\\test1.txt");
171 DeleteFileA("testdir2\\nested\\two.txt");
172 RemoveDirectoryA("testdir2\\test4.txt");
173 RemoveDirectoryA("testdir2\\nested");
174 RemoveDirectoryA("testdir2");
175 RemoveDirectoryA("c:\\testdir3");
176 DeleteFileA("nonexistent\\notreal\\test2.txt");
177 RemoveDirectoryA("nonexistent\\notreal");
178 RemoveDirectoryA("nonexistent");
182 static void test_get_file_info(void)
185 SHFILEINFOA shfi
, shfi2
;
187 char notepad
[MAX_PATH
];
189 /* Test whether fields of SHFILEINFOA are always cleared */
190 memset(&shfi
, 0xcf, sizeof(shfi
));
191 rc
=SHGetFileInfoA("", 0, &shfi
, sizeof(shfi
), 0);
192 ok(rc
, "SHGetFileInfoA('' | 0) should not fail\n");
193 todo_wine
ok(shfi
.hIcon
== 0, "SHGetFileInfoA('' | 0) did not clear hIcon\n");
194 todo_wine
ok(shfi
.szDisplayName
[0] == 0, "SHGetFileInfoA('' | 0) did not clear szDisplayName[0]\n");
195 todo_wine
ok(shfi
.szTypeName
[0] == 0, "SHGetFileInfoA('' | 0) did not clear szTypeName[0]\n");
196 ok(shfi
.iIcon
== 0xcfcfcfcf ||
197 broken(shfi
.iIcon
!= 0xcfcfcfcf), /* NT4 doesn't clear but sets this field */
198 "SHGetFileInfoA('' | 0) should not clear iIcon\n");
199 ok(shfi
.dwAttributes
== 0xcfcfcfcf ||
200 broken(shfi
.dwAttributes
!= 0xcfcfcfcf), /* NT4 doesn't clear but sets this field */
201 "SHGetFileInfoA('' | 0) should not clear dwAttributes\n");
206 /* Test whether fields of SHFILEINFOW are always cleared */
207 memset(&shfiw
, 0xcf, sizeof(shfiw
));
208 memset(&unset_icon
, 0xcf, sizeof(unset_icon
));
209 rc
=pSHGetFileInfoW(NULL
, 0, &shfiw
, sizeof(shfiw
), 0);
210 todo_wine
ok(!rc
, "SHGetFileInfoW(NULL | 0) should fail\n");
211 ok(shfiw
.hIcon
== unset_icon
, "SHGetFileInfoW(NULL | 0) should not clear hIcon\n");
212 todo_wine
ok(shfiw
.szDisplayName
[0] == 0xcfcf, "SHGetFileInfoW(NULL | 0) should not clear szDisplayName[0]\n");
213 todo_wine
ok(shfiw
.szTypeName
[0] == 0xcfcf, "SHGetFileInfoW(NULL | 0) should not clear szTypeName[0]\n");
214 todo_wine
ok(shfiw
.iIcon
== 0xcfcfcfcf, "SHGetFileInfoW(NULL | 0) should not clear iIcon\n");
215 ok(shfiw
.dwAttributes
== 0xcfcfcfcf, "SHGetFileInfoW(NULL | 0) should not clear dwAttributes\n");
218 win_skip("SHGetFileInfoW is not available\n");
221 /* Test some flag combinations that MSDN claims are not allowed,
222 * but which work anyway
224 memset(&shfi
, 0xcf, sizeof(shfi
));
225 rc
=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY
,
227 SHGFI_ATTRIBUTES
| SHGFI_USEFILEATTRIBUTES
);
228 ok(rc
, "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) failed\n");
230 ok(shfi
.dwAttributes
!= 0xcfcfcfcf, "dwFileAttributes is not set\n");
231 todo_wine
ok(shfi
.hIcon
== 0, "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) did not clear hIcon\n");
232 todo_wine
ok(shfi
.szDisplayName
[0] == 0, "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) did not clear szDisplayName[0]\n");
233 todo_wine
ok(shfi
.szTypeName
[0] == 0, "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) did not clear szTypeName[0]\n");
234 ok(shfi
.iIcon
== 0xcfcfcfcf ||
235 broken(shfi
.iIcon
!= 0xcfcfcfcf), /* NT4 doesn't clear but sets this field */
236 "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) should not clear iIcon\n");
238 rc
=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY
,
240 SHGFI_EXETYPE
| SHGFI_USEFILEATTRIBUTES
);
241 todo_wine
ok(rc
== 1, "SHGetFileInfoA(c:\\nonexistent | SHGFI_EXETYPE) returned %d\n", rc
);
243 /* Test SHGFI_USEFILEATTRIBUTES support */
244 strcpy(shfi
.szDisplayName
, "dummy");
245 shfi
.iIcon
=0xdeadbeef;
246 rc
=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY
,
248 SHGFI_ICONLOCATION
| SHGFI_USEFILEATTRIBUTES
);
249 ok(rc
, "SHGetFileInfoA(c:\\nonexistent) failed\n");
252 ok(strcpy(shfi
.szDisplayName
, "dummy") != 0, "SHGetFileInfoA(c:\\nonexistent) displayname is not set\n");
253 ok(shfi
.iIcon
!= 0xdeadbeef, "SHGetFileInfoA(c:\\nonexistent) iIcon is not set\n");
256 /* Wine does not have a default icon for text files, and Windows 98 fails
257 * if we give it an empty executable. So use notepad.exe as the test
259 if (SearchPath(NULL
, "notepad.exe", NULL
, sizeof(notepad
), notepad
, NULL
))
261 strcpy(shfi
.szDisplayName
, "dummy");
262 shfi
.iIcon
=0xdeadbeef;
263 rc
=SHGetFileInfoA(notepad
, GetFileAttributes(notepad
),
265 SHGFI_ICONLOCATION
| SHGFI_USEFILEATTRIBUTES
);
266 ok(rc
, "SHGetFileInfoA(%s, SHGFI_USEFILEATTRIBUTES) failed\n", notepad
);
267 strcpy(shfi2
.szDisplayName
, "dummy");
268 shfi2
.iIcon
=0xdeadbeef;
269 rc2
=SHGetFileInfoA(notepad
, 0,
270 &shfi2
, sizeof(shfi2
),
272 ok(rc2
, "SHGetFileInfoA(%s) failed\n", notepad
);
275 ok(lstrcmpi(shfi2
.szDisplayName
, shfi
.szDisplayName
) == 0, "wrong display name %s != %s\n", shfi
.szDisplayName
, shfi2
.szDisplayName
);
276 ok(shfi2
.iIcon
== shfi
.iIcon
, "wrong icon index %d != %d\n", shfi
.iIcon
, shfi2
.iIcon
);
280 /* with a directory now */
281 strcpy(shfi
.szDisplayName
, "dummy");
282 shfi
.iIcon
=0xdeadbeef;
283 rc
=SHGetFileInfoA("test4.txt", GetFileAttributes("test4.txt"),
285 SHGFI_ICONLOCATION
| SHGFI_USEFILEATTRIBUTES
);
286 ok(rc
, "SHGetFileInfoA(test4.txt/, SHGFI_USEFILEATTRIBUTES) failed\n");
287 strcpy(shfi2
.szDisplayName
, "dummy");
288 shfi2
.iIcon
=0xdeadbeef;
289 rc2
=SHGetFileInfoA("test4.txt", 0,
290 &shfi2
, sizeof(shfi2
),
292 ok(rc2
, "SHGetFileInfoA(test4.txt/) failed\n");
295 ok(lstrcmpi(shfi2
.szDisplayName
, shfi
.szDisplayName
) == 0, "wrong display name %s != %s\n", shfi
.szDisplayName
, shfi2
.szDisplayName
);
296 ok(shfi2
.iIcon
== shfi
.iIcon
, "wrong icon index %d != %d\n", shfi
.iIcon
, shfi2
.iIcon
);
300 static void test_get_file_info_iconlist(void)
302 /* Test retrieving a handle to the system image list, and
303 * what that returns for hIcon
306 HIMAGELIST hSysImageList
;
307 LPITEMIDLIST pidList
;
311 hr
= SHGetSpecialFolderLocation(NULL
, CSIDL_DESKTOP
, &pidList
);
313 skip("can't get desktop pidl\n");
317 memset(&shInfoa
, 0xcf, sizeof(shInfoa
));
318 hSysImageList
= (HIMAGELIST
) SHGetFileInfoA((const char *)pidList
, 0,
319 &shInfoa
, sizeof(shInfoa
),
320 SHGFI_SYSICONINDEX
| SHGFI_SMALLICON
| SHGFI_PIDL
);
321 ok(hSysImageList
!= INVALID_HANDLE_VALUE
, "Can't get handle for CSIDL_DESKTOP imagelist\n");
322 todo_wine
ok(shInfoa
.hIcon
== 0, "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear hIcon\n");
323 todo_wine
ok(shInfoa
.szTypeName
[0] == 0, "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear szTypeName[0]\n");
324 ok(shInfoa
.iIcon
!= 0xcfcfcfcf, "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) should set iIcon\n");
325 ok(shInfoa
.dwAttributes
== 0xcfcfcfcf ||
326 shInfoa
.dwAttributes
== 0 || /* Vista */
327 broken(shInfoa
.dwAttributes
!= 0xcfcfcfcf), /* NT4 doesn't clear but sets this field */
328 "SHGetFileInfoA(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL), unexpected dwAttributes\n");
329 CloseHandle(hSysImageList
);
331 if (!pSHGetFileInfoW
)
333 win_skip("SHGetFileInfoW is not available\n");
338 memset(&shInfow
, 0xcf, sizeof(shInfow
));
339 hSysImageList
= (HIMAGELIST
) pSHGetFileInfoW((const WCHAR
*)pidList
, 0,
340 &shInfow
, sizeof(shInfow
),
341 SHGFI_SYSICONINDEX
| SHGFI_SMALLICON
| SHGFI_PIDL
);
344 win_skip("SHGetFileInfoW is not implemented\n");
347 ok(hSysImageList
!= INVALID_HANDLE_VALUE
, "Can't get handle for CSIDL_DESKTOP imagelist\n");
348 todo_wine
ok(shInfow
.hIcon
== 0, "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear hIcon\n");
349 ok(shInfow
.szTypeName
[0] == 0, "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) did not clear szTypeName[0]\n");
350 ok(shInfow
.iIcon
!= 0xcfcfcfcf, "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) should set iIcon\n");
351 ok(shInfow
.dwAttributes
== 0xcfcfcfcf ||
352 shInfoa
.dwAttributes
== 0, /* Vista */
353 "SHGetFileInfoW(CSIDL_DESKTOP, SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_PIDL) unexpected dwAttributes\n");
354 CloseHandle(hSysImageList
);
356 /* Various suposidly invalid flag testing */
357 memset(&shInfow
, 0xcf, sizeof(shInfow
));
358 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
359 SHGFI_SYSICONINDEX
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
);
360 ok(hr
!= 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n");
361 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
362 ok(shInfow
.dwAttributes
==0xcfcfcfcf ||
363 shInfoa
.dwAttributes
==0, /* Vista */
364 "unexpected dwAttributes\n");
366 memset(&shInfow
, 0xcf, sizeof(shInfow
));
367 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
368 SHGFI_ICON
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
);
369 ok(hr
!= 0, " SHGFI_ICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n");
370 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
371 ok(shInfow
.hIcon
!=(HICON
)0xcfcfcfcf && shInfow
.hIcon
!=0,"hIcon invalid\n");
372 if (shInfow
.hIcon
!=(HICON
)0xcfcfcfcf) DestroyIcon(shInfow
.hIcon
);
373 todo_wine
ok(shInfow
.dwAttributes
==0,"dwAttributes not set\n");
375 memset(&shInfow
, 0xcf, sizeof(shInfow
));
376 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
377 SHGFI_ICON
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_LARGEICON
);
378 ok(hr
!= 0, "SHGFI_ICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON Failed\n");
379 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
380 ok(shInfow
.hIcon
!=(HICON
)0xcfcfcfcf && shInfow
.hIcon
!=0,"hIcon invalid\n");
381 if (shInfow
.hIcon
!= (HICON
)0xcfcfcfcf) DestroyIcon(shInfow
.hIcon
);
382 todo_wine
ok(shInfow
.dwAttributes
==0,"dwAttributes not set\n");
384 memset(&shInfow
, 0xcf, sizeof(shInfow
));
385 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
386 SHGFI_SYSICONINDEX
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_LARGEICON
);
387 ok(hr
!= 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_LARGEICON Failed\n");
388 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
389 ok(shInfow
.dwAttributes
==0xcfcfcfcf ||
390 shInfoa
.dwAttributes
==0, /* Vista */
391 "unexpected dwAttributes\n");
393 memset(&shInfow
, 0xcf, sizeof(shInfow
));
394 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
395 SHGFI_OPENICON
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
);
396 ok(hr
!= 0, "SHGFI_OPENICON|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n");
397 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
398 ok(shInfow
.dwAttributes
==0xcfcfcfcf,"dwAttributes modified\n");
400 memset(&shInfow
, 0xcf, sizeof(shInfow
));
401 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
402 SHGFI_SHELLICONSIZE
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
);
403 ok(hr
!= 0, "SHGFI_SHELLICONSIZE|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n");
404 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
405 ok(shInfow
.dwAttributes
==0xcfcfcfcf,"dwAttributes modified\n");
407 memset(&shInfow
, 0xcf, sizeof(shInfow
));
408 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
409 SHGFI_SHELLICONSIZE
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
);
410 ok(hr
!= 0, "SHGFI_SHELLICONSIZE|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON Failed\n");
411 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
412 ok(shInfow
.dwAttributes
==0xcfcfcfcf,"dwAttributes modified\n");
414 memset(&shInfow
, 0xcf, sizeof(shInfow
));
415 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
416 SHGFI_SYSICONINDEX
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
|
418 ok(hr
!= 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_ATTRIBUTES Failed\n");
419 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
420 ok(shInfow
.dwAttributes
!=0xcfcfcfcf,"dwAttributes not set\n");
422 memset(&shInfow
, 0xcf, sizeof(shInfow
));
423 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
424 SHGFI_SYSICONINDEX
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
|
426 todo_wine
ok(hr
!= 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_EXETYPE Failed\n");
427 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
428 ok(shInfow
.dwAttributes
==0xcfcfcfcf ||
429 shInfoa
.dwAttributes
==0, /* Vista */
430 "unexpected dwAttributes\n");
432 memset(&shInfow
, 0xcf, sizeof(shInfow
));
433 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
434 SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
|SHGFI_EXETYPE
);
435 todo_wine
ok(hr
!= 0, "SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_EXETYPE Failed\n");
436 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
437 ok(shInfow
.dwAttributes
==0xcfcfcfcf,"dwAttributes modified\n");
439 memset(&shInfow
, 0xcf, sizeof(shInfow
));
440 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
441 SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_SMALLICON
|SHGFI_ATTRIBUTES
);
442 ok(hr
!= 0, "SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_ATTRIBUTES Failed\n");
443 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
444 ok(shInfow
.dwAttributes
!=0xcfcfcfcf,"dwAttributes not set\n");
446 memset(&shInfow
, 0xcf, sizeof(shInfow
));
447 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
448 SHGFI_SYSICONINDEX
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|
450 ok(hr
!= 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_ATTRIBUTES Failed\n");
451 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
452 ok(shInfow
.dwAttributes
!=0xcfcfcfcf,"dwAttributes not set\n");
454 memset(&shInfow
, 0xcf, sizeof(shInfow
));
455 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
456 SHGFI_SYSICONINDEX
|SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_EXETYPE
);
457 todo_wine
ok(hr
!= 0, "SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_EXETYPE Failed\n");
458 ok(shInfow
.iIcon
!=0xcfcfcfcf, "Icon Index Missing\n");
459 ok(shInfow
.dwAttributes
==0xcfcfcfcf ||
460 shInfoa
.dwAttributes
==0, /* Vista */
461 "unexpected dwAttributes\n");
463 memset(&shInfow
, 0xcf, sizeof(shInfow
));
464 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
465 SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_EXETYPE
);
466 todo_wine
ok(hr
!= 0, "SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_EXETYPE Failed\n");
467 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
468 ok(shInfow
.dwAttributes
==0xcfcfcfcf,"dwAttributes modified\n");
470 memset(&shInfow
, 0xcf, sizeof(shInfow
));
471 hr
= pSHGetFileInfoW((const WCHAR
*)pidList
, 0, &shInfow
, sizeof(shInfow
),
472 SHGFI_USEFILEATTRIBUTES
|SHGFI_PIDL
|SHGFI_ATTRIBUTES
);
473 ok(hr
!= 0, "SHGFI_USEFILEATTRIBUTES|SHGFI_PIDL|SHGFI_ATTRIBUTES Failed\n");
474 todo_wine
ok(shInfow
.iIcon
==0xcfcfcfcf, "Icon Index Modified\n");
475 ok(shInfow
.dwAttributes
!=0xcfcfcfcf,"dwAttributes not set\n");
482 puts into the specified buffer file names with current directory.
483 files - string with file names, separated by null characters. Ends on a double
486 static void set_curr_dir_path(CHAR
*buf
, const CHAR
* files
)
491 strcpy(buf
, CURR_DIR
);
496 buf
+= strlen(buf
) + 1;
497 files
+= strlen(files
) + 1;
503 /* tests the FO_DELETE action */
504 static void test_delete(void)
506 SHFILEOPSTRUCTA shfo
;
508 CHAR buf
[sizeof(CURR_DIR
)+sizeof("/test?.txt")+1];
510 sprintf(buf
, "%s\\%s", CURR_DIR
, "test?.txt");
511 buf
[strlen(buf
) + 1] = '\0';
514 shfo
.wFunc
= FO_DELETE
;
517 shfo
.fFlags
= FOF_FILESONLY
| FOF_NOCONFIRMATION
| FOF_SILENT
;
518 shfo
.hNameMappings
= NULL
;
519 shfo
.lpszProgressTitle
= NULL
;
521 ok(!SHFileOperationA(&shfo
), "Deletion was not successful\n");
522 ok(dir_exists("test4.txt"), "Directory should not have been removed\n");
523 ok(!file_exists("test1.txt"), "File should have been removed\n");
524 ok(!file_exists("test2.txt"), "File should have been removed\n");
525 ok(!file_exists("test3.txt"), "File should have been removed\n");
527 ret
= SHFileOperationA(&shfo
);
528 ok(ret
== ERROR_SUCCESS
, "Directory exists, but is not removed, ret=%d\n", ret
);
529 ok(dir_exists("test4.txt"), "Directory should not have been removed\n");
531 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
533 ok(!SHFileOperationA(&shfo
), "Directory is not removed\n");
534 ok(!dir_exists("test4.txt"), "Directory should have been removed\n");
536 ret
= SHFileOperationA(&shfo
);
537 ok(!ret
, "The requested file does not exist, ret=%d\n", ret
);
540 sprintf(buf
, "%s\\%s", CURR_DIR
, "test4.txt");
541 buf
[strlen(buf
) + 1] = '\0';
542 ok(MoveFileA("test1.txt", "test4.txt\\test1.txt"), "Filling the subdirectory failed\n");
543 ok(!SHFileOperationA(&shfo
), "Directory is not removed\n");
544 ok(!dir_exists("test4.txt"), "Directory is not removed\n");
547 shfo
.pFrom
= "test1.txt\0test4.txt\0";
548 ok(!SHFileOperationA(&shfo
), "Directory and a file are not removed\n");
549 ok(!file_exists("test1.txt"), "The file should have been removed\n");
550 ok(!dir_exists("test4.txt"), "Directory should have been removed\n");
551 ok(file_exists("test2.txt"), "This file should not have been removed\n");
553 /* FOF_FILESONLY does not delete a dir matching a wildcard */
555 shfo
.fFlags
|= FOF_FILESONLY
;
556 shfo
.pFrom
= "*.txt\0";
557 ok(!SHFileOperation(&shfo
), "Failed to delete files\n");
558 ok(!file_exists("test1.txt"), "test1.txt should have been removed\n");
559 ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
560 ok(dir_exists("test4.txt"), "test4.txt should not have been removed\n");
562 /* FOF_FILESONLY only deletes a dir if explicitly specified */
564 shfo
.pFrom
= "test_?.txt\0test4.txt\0";
565 ok(!SHFileOperation(&shfo
), "Failed to delete files and directory\n");
566 ok(!dir_exists("test4.txt") ||
567 broken(dir_exists("test4.txt")), /* NT4 */
568 "test4.txt should have been removed\n");
569 ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
570 ok(file_exists("test1.txt"), "test1.txt should not have been removed\n");
572 /* try to delete an invalid filename */
574 /* this crashes on win9x */
577 shfo
.fFlags
&= ~FOF_FILESONLY
;
578 shfo
.fAnyOperationsAborted
= FALSE
;
579 ret
= SHFileOperation(&shfo
);
580 ok(ret
== ERROR_ACCESS_DENIED
, "Expected ERROR_ACCESS_DENIED, got %d\n", ret
);
581 ok(!shfo
.fAnyOperationsAborted
, "Expected no aborted operations\n");
582 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
585 /* try an invalid function */
587 shfo
.pFrom
= "test1.txt\0";
589 ret
= SHFileOperation(&shfo
);
590 ok(ret
== ERROR_INVALID_PARAMETER
||
591 broken(ret
== ERROR_SUCCESS
), /* Win9x, NT4 */
592 "Expected ERROR_INVALID_PARAMETER, got %d\n", ret
);
593 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
595 /* try an invalid list, only one null terminator */
597 /* this crashes on win9x */
600 shfo
.wFunc
= FO_DELETE
;
601 ret
= SHFileOperation(&shfo
);
602 ok(ret
== ERROR_ACCESS_DENIED
, "Expected ERROR_ACCESS_DENIED, got %d\n", ret
);
603 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
606 /* delete a nonexistent file */
607 shfo
.pFrom
= "nonexistent.txt\0";
608 shfo
.wFunc
= FO_DELETE
;
609 ret
= SHFileOperation(&shfo
);
612 ret
== ERROR_FILE_NOT_FOUND
|| /* Vista */
613 broken(ret
== ERROR_SUCCESS
), /* NT4 */
614 "Expected 1026 or ERROR_FILE_NOT_FOUND, got %d\n", ret
);
616 /* delete a dir, and then a file inside the dir, same as
617 * deleting a nonexistent file
619 if (ret
!= ERROR_FILE_NOT_FOUND
)
621 /* Vista would throw up a dialog box that we can't suppress */
623 shfo
.pFrom
= "testdir2\0testdir2\\one.txt\0";
624 ret
= SHFileOperation(&shfo
);
625 ok(ret
== ERROR_PATH_NOT_FOUND
||
626 broken(ret
== ERROR_SUCCESS
), /* NT4 */
627 "Expected ERROR_PATH_NOT_FOUND, got %d\n", ret
);
628 ok(!dir_exists("testdir2"), "Expected testdir2 to not exist\n");
629 ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
632 skip("Test would show a dialog box\n");
634 /* try the FOF_NORECURSION flag, continues deleting subdirs */
636 shfo
.pFrom
= "testdir2\0";
637 shfo
.fFlags
|= FOF_NORECURSION
;
638 ret
= SHFileOperation(&shfo
);
639 ok(ret
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", ret
);
640 ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
641 ok(!dir_exists("testdir2\\nested"), "Expected testdir2\\nested to not exist\n");
644 /* tests the FO_RENAME action */
645 static void test_rename(void)
647 SHFILEOPSTRUCTA shfo
, shfo2
;
648 CHAR from
[5*MAX_PATH
];
653 shfo
.wFunc
= FO_RENAME
;
656 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
657 shfo
.hNameMappings
= NULL
;
658 shfo
.lpszProgressTitle
= NULL
;
660 set_curr_dir_path(from
, "test1.txt\0");
661 set_curr_dir_path(to
, "test4.txt\0");
662 retval
= SHFileOperationA(&shfo
);
663 ok(retval
== ERROR_ALREADY_EXISTS
||
664 retval
== DE_FILEDESTISFLD
|| /* Vista */
665 broken(retval
== ERROR_INVALID_NAME
), /* Win9x, NT4 */
666 "Expected ERROR_ALREADY_EXISTS or DE_FILEDESTISFLD, got %d\n", retval
);
667 ok(file_exists("test1.txt"), "The file is renamed\n");
669 set_curr_dir_path(from
, "test3.txt\0");
670 set_curr_dir_path(to
, "test4.txt\\test1.txt\0");
671 retval
= SHFileOperationA(&shfo
);
672 if (retval
== DE_DIFFDIR
)
674 /* Vista and W2K8 (broken or new behavior ?) */
675 ok(!file_exists("test4.txt\\test1.txt"), "The file is renamed\n");
679 ok(retval
== ERROR_SUCCESS
, "File is renamed moving to other directory\n");
680 ok(file_exists("test4.txt\\test1.txt"), "The file is not renamed\n");
683 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
684 set_curr_dir_path(to
, "test6.txt\0test7.txt\0test8.txt\0");
685 retval
= SHFileOperationA(&shfo
);
686 ok(retval
== ERROR_GEN_FAILURE
||
687 retval
== DE_MANYSRC1DEST
|| /* Vista */
688 broken(retval
== ERROR_SUCCESS
), /* Win9x */
689 "Expected ERROR_GEN_FAILURE or DE_MANYSRC1DEST , got %d\n", retval
);
690 ok(file_exists("test1.txt"), "The file is renamed - many files are specified\n");
692 memcpy(&shfo2
, &shfo
, sizeof(SHFILEOPSTRUCTA
));
693 shfo2
.fFlags
|= FOF_MULTIDESTFILES
;
695 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
696 set_curr_dir_path(to
, "test6.txt\0test7.txt\0test8.txt\0");
697 retval
= SHFileOperationA(&shfo2
);
698 ok(retval
== ERROR_GEN_FAILURE
||
699 retval
== DE_MANYSRC1DEST
|| /* Vista */
700 broken(retval
== ERROR_SUCCESS
), /* Win9x */
701 "Expected ERROR_GEN_FAILURE or DE_MANYSRC1DEST files, got %d\n", retval
);
702 ok(file_exists("test1.txt"), "The file is not renamed - many files are specified\n");
704 set_curr_dir_path(from
, "test1.txt\0");
705 set_curr_dir_path(to
, "test6.txt\0");
706 retval
= SHFileOperationA(&shfo
);
707 ok(retval
== ERROR_SUCCESS
, "Rename file failed, retval = %d\n", retval
);
708 ok(!file_exists("test1.txt"), "The file is not renamed\n");
709 ok(file_exists("test6.txt"), "The file is not renamed\n");
711 set_curr_dir_path(from
, "test6.txt\0");
712 set_curr_dir_path(to
, "test1.txt\0");
713 retval
= SHFileOperationA(&shfo
);
714 ok(retval
== ERROR_SUCCESS
, "Rename file back failed, retval = %d\n", retval
);
716 set_curr_dir_path(from
, "test4.txt\0");
717 set_curr_dir_path(to
, "test6.txt\0");
718 retval
= SHFileOperationA(&shfo
);
719 ok(retval
== ERROR_SUCCESS
, "Rename dir failed, retval = %d\n", retval
);
720 ok(!dir_exists("test4.txt"), "The dir is not renamed\n");
721 ok(dir_exists("test6.txt"), "The dir is not renamed\n");
723 set_curr_dir_path(from
, "test6.txt\0");
724 set_curr_dir_path(to
, "test4.txt\0");
725 retval
= SHFileOperationA(&shfo
);
726 ok(retval
== ERROR_SUCCESS
, "Rename dir back failed, retval = %d\n", retval
);
727 ok(dir_exists("test4.txt"), "The dir is not renamed\n");
729 /* try to rename more than one file to a single file */
730 shfo
.pFrom
= "test1.txt\0test2.txt\0";
731 shfo
.pTo
= "a.txt\0";
732 retval
= SHFileOperationA(&shfo
);
733 ok(retval
== ERROR_GEN_FAILURE
||
734 retval
== DE_MANYSRC1DEST
|| /* Vista */
735 broken(retval
== ERROR_SUCCESS
), /* Win9x */
736 "Expected ERROR_GEN_FAILURE or DE_MANYSRC1DEST, got %d\n", retval
);
737 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
738 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
739 ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
741 /* pFrom doesn't exist */
742 shfo
.pFrom
= "idontexist\0";
743 shfo
.pTo
= "newfile\0";
744 retval
= SHFileOperationA(&shfo
);
746 retval
== ERROR_FILE_NOT_FOUND
|| /* Vista */
747 broken(retval
== ERROR_SUCCESS
), /* NT4 */
748 "Expected 1026 or ERROR_FILE_NOT_FOUND, got %d\n", retval
);
749 ok(!file_exists("newfile"), "Expected newfile to not exist\n");
751 /* pTo already exist */
752 shfo
.pFrom
= "test1.txt\0";
753 shfo
.pTo
= "test2.txt\0";
754 retval
= SHFileOperationA(&shfo
);
755 if (retval
== ERROR_SUCCESS
)
757 /* Vista and W2K8 (broken or new behavior ?) */
758 createTestFile("test1.txt");
762 ok(retval
== ERROR_ALREADY_EXISTS
||
763 broken(retval
== DE_OPCANCELLED
) || /* NT4 */
764 broken(retval
== ERROR_INVALID_NAME
), /* Win9x */
765 "Expected ERROR_ALREADY_EXISTS, got %d\n", retval
);
768 /* pFrom is valid, but pTo is empty */
769 shfo
.pFrom
= "test1.txt\0";
771 retval
= SHFileOperationA(&shfo
);
772 ok(retval
== ERROR_CANCELLED
||
773 retval
== DE_DIFFDIR
|| /* Vista */
774 broken(retval
== DE_OPCANCELLED
) || /* Win9x */
775 broken(retval
== 65652), /* NT4 */
776 "Expected ERROR_CANCELLED or DE_DIFFDIR\n");
777 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
781 retval
= SHFileOperationA(&shfo
);
782 ok(retval
== ERROR_ACCESS_DENIED
||
783 retval
== DE_MANYSRC1DEST
|| /* Vista */
784 broken(retval
== ERROR_SUCCESS
), /* Win9x */
785 "Expected ERROR_ACCESS_DENIED or DE_MANYSRC1DEST, got %d\n", retval
);
787 /* pFrom is NULL, commented out because it crashes on nt 4.0 */
791 retval
= SHFileOperationA(&shfo
);
792 ok(retval
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", retval
);
796 /* tests the FO_COPY action */
797 static void test_copy(void)
799 SHFILEOPSTRUCTA shfo
, shfo2
;
800 CHAR from
[5*MAX_PATH
];
802 FILEOP_FLAGS tmp_flags
;
808 shfo
.wFunc
= FO_COPY
;
811 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
812 shfo
.hNameMappings
= NULL
;
813 shfo
.lpszProgressTitle
= NULL
;
815 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
816 set_curr_dir_path(to
, "test6.txt\0test7.txt\0test8.txt\0");
817 retval
= SHFileOperationA(&shfo
);
818 if (dir_exists("test6.txt"))
820 /* Vista and W2K8 (broken or new behavior ?) */
821 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
822 ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not copied - many files "
823 "are specified as a target\n");
824 DeleteFileA("test6.txt\\test2.txt");
825 RemoveDirectoryA("test6.txt\\test4.txt");
826 RemoveDirectoryA("test6.txt");
830 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
831 ok(!file_exists("test6.txt"), "The file is copied - many files are "
832 "specified as a target\n");
835 memcpy(&shfo2
, &shfo
, sizeof(SHFILEOPSTRUCTA
));
836 shfo2
.fFlags
|= FOF_MULTIDESTFILES
;
838 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
839 set_curr_dir_path(to
, "test6.txt\0test7.txt\0test8.txt\0");
840 ok(!SHFileOperationA(&shfo2
), "Can't copy many files\n");
841 ok(file_exists("test6.txt"), "The file is not copied - many files are "
842 "specified as a target\n");
843 DeleteFileA("test6.txt");
844 DeleteFileA("test7.txt");
845 RemoveDirectoryA("test8.txt");
847 /* number of sources do not correspond to number of targets */
848 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
849 set_curr_dir_path(to
, "test6.txt\0test7.txt\0");
850 retval
= SHFileOperationA(&shfo2
);
851 if (dir_exists("test6.txt"))
853 /* Vista and W2K8 (broken or new behavior ?) */
854 ok(retval
== DE_DESTSAMETREE
, "Expected DE_DESTSAMETREE, got %d\n", retval
);
855 ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not copied - many files "
856 "are specified as a target\n");
857 RemoveDirectoryA("test6.txt");
858 ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not copied - many files "
859 "are specified as a target\n");
860 RemoveDirectoryA("test7.txt");
864 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
865 ok(!file_exists("test6.txt"), "The file is copied - many files are "
866 "specified as a target\n");
869 set_curr_dir_path(from
, "test1.txt\0");
870 set_curr_dir_path(to
, "test4.txt\0");
871 ok(!SHFileOperationA(&shfo
), "Prepare test to check how directories are copied recursively\n");
872 ok(file_exists("test4.txt\\test1.txt"), "The file is copied\n");
874 set_curr_dir_path(from
, "test?.txt\0");
875 set_curr_dir_path(to
, "testdir2\0");
876 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
877 ok(!file_exists("testdir2\\test4.txt"), "The directory is not copied yet\n");
878 ok(!SHFileOperationA(&shfo
), "Files and directories are copied to directory\n");
879 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
880 ok(file_exists("testdir2\\test4.txt"), "The directory is copied\n");
881 ok(file_exists("testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied\n");
882 clean_after_shfo_tests();
885 shfo
.fFlags
|= FOF_FILESONLY
;
886 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
887 ok(!file_exists("testdir2\\test4.txt"), "The directory is not copied yet\n");
888 ok(!SHFileOperationA(&shfo
), "Files are copied to other directory\n");
889 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
890 ok(!file_exists("testdir2\\test4.txt"), "The directory is copied\n");
891 clean_after_shfo_tests();
894 set_curr_dir_path(from
, "test1.txt\0test2.txt\0");
895 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
896 ok(!file_exists("testdir2\\test2.txt"), "The file is not copied yet\n");
897 ok(!SHFileOperationA(&shfo
), "Files are copied to other directory\n");
898 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
899 ok(file_exists("testdir2\\test2.txt"), "The file is copied\n");
900 clean_after_shfo_tests();
902 /* Copying multiple files with one not existing as source, fails the
903 entire operation in Win98/ME/2K/XP, but not in 95/NT */
905 tmp_flags
= shfo
.fFlags
;
906 set_curr_dir_path(from
, "test1.txt\0test10.txt\0test2.txt\0");
907 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
908 ok(!file_exists("testdir2\\test2.txt"), "The file is not copied yet\n");
909 retval
= SHFileOperationA(&shfo
);
910 if (retval
== ERROR_SUCCESS
)
911 /* Win 95/NT returns success but copies only the files up to the nonexistent source */
912 ok(file_exists("testdir2\\test1.txt"), "The file is not copied\n");
915 /* Failure if one source file does not exist */
916 ok(retval
== 1026 || /* Win 98/ME/2K/XP */
917 retval
== ERROR_FILE_NOT_FOUND
, /* Vista and W2K8 */
918 "Files are copied to other directory\n");
919 ok(!file_exists("testdir2\\test1.txt"), "The file is copied\n");
921 ok(!file_exists("testdir2\\test2.txt"), "The file is copied\n");
922 shfo
.fFlags
= tmp_flags
;
924 /* copy into a nonexistent directory */
926 shfo
.fFlags
= FOF_NOCONFIRMMKDIR
;
927 set_curr_dir_path(from
, "test1.txt\0");
928 set_curr_dir_path(to
, "nonexistent\\notreal\\test2.txt\0");
929 retval
= SHFileOperation(&shfo
);
930 ok(!retval
, "Error copying into nonexistent directory\n");
931 ok(file_exists("nonexistent"), "nonexistent not created\n");
932 ok(file_exists("nonexistent\\notreal"), "nonexistent\\notreal not created\n");
933 ok(file_exists("nonexistent\\notreal\\test2.txt"), "Directory not created\n");
934 ok(!file_exists("nonexistent\\notreal\\test1.txt"), "test1.txt should not exist\n");
936 /* a relative dest directory is OK */
937 clean_after_shfo_tests();
939 shfo
.pFrom
= "test1.txt\0test2.txt\0test3.txt\0";
940 shfo
.pTo
= "testdir2\0";
941 retval
= SHFileOperation(&shfo
);
942 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
943 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1 to exist\n");
945 /* try to copy files to a file */
946 clean_after_shfo_tests();
950 /* suppress the error-dialog in win9x here */
951 shfo
.fFlags
|= FOF_NOERRORUI
;
952 set_curr_dir_path(from
, "test1.txt\0test2.txt\0");
953 set_curr_dir_path(to
, "test3.txt\0");
954 retval
= SHFileOperation(&shfo
);
955 if (retval
== DE_FLDDESTISFILE
)
957 /* Vista and W2K8 (broken or new behavior ?) */
958 ok(!shfo
.fAnyOperationsAborted
, "Didn't expect aborted operations\n");
962 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
963 ok(shfo
.fAnyOperationsAborted
, "Expected aborted operations\n");
965 ok(!file_exists("test3.txt\\test2.txt"), "Expected test3.txt\\test2.txt to not exist\n");
967 /* try to copy many files to nonexistent directory */
969 shfo
.fFlags
&= ~FOF_NOERRORUI
;
970 shfo
.fAnyOperationsAborted
= FALSE
;
971 retval
= SHFileOperation(&shfo
);
972 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
973 ok(DeleteFile("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
974 ok(DeleteFile("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
975 ok(RemoveDirectory(to
), "Expected test3.txt to exist\n");
977 /* send in FOF_MULTIDESTFILES with too many destination files */
979 shfo
.pFrom
= "test1.txt\0test2.txt\0test3.txt\0";
980 shfo
.pTo
= "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
981 shfo
.fFlags
|= FOF_NOERRORUI
| FOF_MULTIDESTFILES
;
982 retval
= SHFileOperation(&shfo
);
983 if (dir_exists("testdir2\\a.txt"))
985 /* Vista and W2K8 (broken or new behavior ?) */
986 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
987 ok(DeleteFile("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
988 RemoveDirectory("testdir2\\a.txt");
989 ok(DeleteFile("testdir2\\b.txt\\test2.txt"), "Expected testdir2\\b.txt\\test2.txt to exist\n");
990 RemoveDirectory("testdir2\\b.txt");
991 ok(DeleteFile("testdir2\\c.txt\\test3.txt"), "Expected testdir2\\c.txt\\test3.txt to exist\n");
992 RemoveDirectory("testdir2\\c.txt");
993 ok(!file_exists("testdir2\\d.txt"), "Expected testdir2\\d.txt to not exist\n");
997 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
998 ok(shfo
.fAnyOperationsAborted
||
999 broken(!shfo
.fAnyOperationsAborted
), /* NT4 */
1000 "Expected aborted operations\n");
1001 ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\a.txt to not exist\n");
1004 /* send in FOF_MULTIDESTFILES with too many destination files */
1005 shfo
.pFrom
= "test1.txt\0test2.txt\0test3.txt\0";
1006 shfo
.pTo
= "e.txt\0f.txt\0";
1007 shfo
.fAnyOperationsAborted
= FALSE
;
1008 retval
= SHFileOperation(&shfo
);
1009 if (dir_exists("e.txt"))
1011 /* Vista and W2K8 (broken or new behavior ?) */
1012 ok(retval
== DE_SAMEFILE
, "Expected DE_SAMEFILE, got %d\n", retval
);
1013 ok(DeleteFile("e.txt\\test1.txt"), "Expected e.txt\\test1.txt to exist\n");
1014 RemoveDirectory("e.txt");
1015 ok(DeleteFile("f.txt\\test2.txt"), "Expected f.txt\\test2.txt to exist\n");
1016 RemoveDirectory("f.txt");
1020 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1021 ok(shfo
.fAnyOperationsAborted
||
1022 broken(!shfo
.fAnyOperationsAborted
), /* NT4 */
1023 "Expected aborted operations\n");
1024 ok(!file_exists("e.txt"), "Expected e.txt to not exist\n");
1027 /* use FOF_MULTIDESTFILES with files and a source directory */
1028 shfo
.pFrom
= "test1.txt\0test2.txt\0test4.txt\0";
1029 shfo
.pTo
= "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0";
1030 shfo
.fAnyOperationsAborted
= FALSE
;
1031 retval
= SHFileOperation(&shfo
);
1032 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1033 ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
1034 ok(DeleteFile("testdir2\\b.txt"), "Expected testdir2\\b.txt to exist\n");
1035 ok(RemoveDirectory("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
1037 /* try many dest files without FOF_MULTIDESTFILES flag */
1038 shfo
.pFrom
= "test1.txt\0test2.txt\0test3.txt\0";
1039 shfo
.pTo
= "a.txt\0b.txt\0c.txt\0";
1040 shfo
.fAnyOperationsAborted
= FALSE
;
1041 shfo
.fFlags
&= ~FOF_MULTIDESTFILES
;
1042 retval
= SHFileOperation(&shfo
);
1043 if (dir_exists("a.txt"))
1045 /* Vista and W2K8 (broken or new behavior ?) */
1046 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1047 ok(DeleteFile("a.txt\\test1.txt"), "Expected a.txt\\test1.txt to exist\n");
1048 ok(DeleteFile("a.txt\\test2.txt"), "Expected a.txt\\test2.txt to exist\n");
1049 ok(DeleteFile("a.txt\\test3.txt"), "Expected a.txt\\test3.txt to exist\n");
1050 RemoveDirectory("a.txt");
1054 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1055 ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
1059 shfo
.pFrom
= "test?.txt\0";
1060 shfo
.pTo
= "testdir2\0";
1061 shfo
.fFlags
&= ~FOF_MULTIDESTFILES
;
1062 retval
= SHFileOperation(&shfo
);
1063 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1064 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
1066 /* try a glob with FOF_FILESONLY */
1067 clean_after_shfo_tests();
1069 shfo
.pFrom
= "test?.txt\0";
1070 shfo
.fFlags
|= FOF_FILESONLY
;
1071 retval
= SHFileOperation(&shfo
);
1072 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1073 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
1074 ok(!dir_exists("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to not exist\n");
1076 /* try a glob with FOF_MULTIDESTFILES and the same number
1077 * of dest files that we would expect
1079 clean_after_shfo_tests();
1081 shfo
.pTo
= "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
1082 shfo
.fFlags
&= ~FOF_FILESONLY
;
1083 shfo
.fFlags
|= FOF_MULTIDESTFILES
;
1084 retval
= SHFileOperation(&shfo
);
1085 if (dir_exists("testdir2\\a.txt"))
1087 /* Vista and W2K8 (broken or new behavior ?) */
1088 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1089 ok(DeleteFile("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
1090 ok(DeleteFile("testdir2\\a.txt\\test2.txt"), "Expected testdir2\\a.txt\\test2.txt to exist\n");
1091 ok(DeleteFile("testdir2\\a.txt\\test3.txt"), "Expected testdir2\\a.txt\\test3.txt to exist\n");
1092 ok(RemoveDirectory("testdir2\\a.txt\\test4.txt"), "Expected testdir2\\a.txt\\test4.txt to exist\n");
1093 RemoveDirectory("testdir2\\a.txt");
1097 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1098 ok(shfo
.fAnyOperationsAborted
||
1099 broken(!shfo
.fAnyOperationsAborted
), /* NT4 */
1100 "Expected aborted operations\n");
1101 ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\test1.txt to not exist\n");
1103 ok(!RemoveDirectory("b.txt"), "b.txt should not exist\n");
1105 /* copy one file to two others, second is ignored */
1106 clean_after_shfo_tests();
1108 shfo
.pFrom
= "test1.txt\0";
1109 shfo
.pTo
= "b.txt\0c.txt\0";
1110 shfo
.fAnyOperationsAborted
= FALSE
;
1111 retval
= SHFileOperation(&shfo
);
1112 if (retval
== DE_OPCANCELLED
)
1114 /* NT4 fails and doesn't copy any files */
1115 ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
1116 /* Needed to skip some tests */
1117 win_skip("Skipping some tests on NT4\n");
1122 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1123 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
1125 ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
1127 /* copy two file to three others, all fail */
1128 shfo
.pFrom
= "test1.txt\0test2.txt\0";
1129 shfo
.pTo
= "b.txt\0c.txt\0d.txt\0";
1130 retval
= SHFileOperation(&shfo
);
1131 if (dir_exists("b.txt"))
1133 /* Vista and W2K8 (broken or new behavior ?) */
1134 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1135 ok(DeleteFile("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
1136 RemoveDirectory("b.txt");
1137 ok(DeleteFile("c.txt\\test2.txt"), "Expected c.txt\\test2.txt to exist\n");
1138 RemoveDirectory("c.txt");
1142 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1143 ok(shfo
.fAnyOperationsAborted
||
1144 broken(!shfo
.fAnyOperationsAborted
), /* NT4 */
1145 "Expected aborted operations\n");
1146 ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
1149 /* copy one file and one directory to three others */
1150 shfo
.pFrom
= "test1.txt\0test4.txt\0";
1151 shfo
.pTo
= "b.txt\0c.txt\0d.txt\0";
1152 shfo
.fAnyOperationsAborted
= FALSE
;
1153 retval
= SHFileOperation(&shfo
);
1154 if (dir_exists("b.txt"))
1156 /* Vista and W2K8 (broken or new behavior ?) */
1157 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1158 ok(DeleteFile("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
1159 RemoveDirectory("b.txt");
1160 ok(RemoveDirectory("c.txt\\test4.txt"), "Expected c.txt\\test4.txt to exist\n");
1161 RemoveDirectory("c.txt");
1165 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1166 ok(shfo
.fAnyOperationsAborted
||
1167 broken(!shfo
.fAnyOperationsAborted
), /* NT4 */
1168 "Expected aborted operations\n");
1169 ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
1170 ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
1173 /* copy a directory with a file beneath it, plus some files */
1174 createTestFile("test4.txt\\a.txt");
1175 shfo
.pFrom
= "test4.txt\0test1.txt\0";
1176 shfo
.pTo
= "testdir2\0";
1177 shfo
.fFlags
&= ~FOF_MULTIDESTFILES
;
1178 shfo
.fAnyOperationsAborted
= FALSE
;
1179 retval
= SHFileOperation(&shfo
);
1180 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1181 ok(DeleteFile("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
1182 ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
1183 ok(RemoveDirectory("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
1185 /* copy one directory and a file in that dir to another dir */
1186 shfo
.pFrom
= "test4.txt\0test4.txt\\a.txt\0";
1187 shfo
.pTo
= "testdir2\0";
1188 retval
= SHFileOperation(&shfo
);
1189 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1190 ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
1191 ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
1193 /* copy a file in a directory first, and then the directory to a nonexistent dir */
1194 shfo
.pFrom
= "test4.txt\\a.txt\0test4.txt\0";
1195 shfo
.pTo
= "nonexistent\0";
1196 retval
= SHFileOperation(&shfo
);
1197 if (dir_exists("nonexistent"))
1199 /* Vista and W2K8 (broken or new behavior ?) */
1200 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1201 ok(DeleteFile("nonexistent\\test4.txt\\a.txt"), "Expected nonexistent\\test4.txt\\a.txt to exist\n");
1202 RemoveDirectory("nonexistent\\test4.txt");
1203 ok(DeleteFile("nonexistent\\a.txt"), "Expected nonexistent\\a.txt to exist\n");
1204 RemoveDirectory("nonexistent");
1208 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1209 ok(shfo
.fAnyOperationsAborted
||
1210 broken(!shfo
.fAnyOperationsAborted
), /* NT4 */
1211 "Expected aborted operations\n");
1212 ok(!file_exists("nonexistent\\test4.txt"), "Expected nonexistent\\test4.txt to not exist\n");
1214 DeleteFile("test4.txt\\a.txt");
1216 /* destination is same as source file */
1217 shfo
.pFrom
= "test1.txt\0test2.txt\0test3.txt\0";
1218 shfo
.pTo
= "b.txt\0test2.txt\0c.txt\0";
1219 shfo
.fAnyOperationsAborted
= FALSE
;
1220 shfo
.fFlags
= FOF_NOERRORUI
| FOF_MULTIDESTFILES
;
1221 retval
= SHFileOperation(&shfo
);
1222 if (retval
== DE_OPCANCELLED
)
1224 /* NT4 fails and doesn't copy any files */
1225 ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
1229 ok(retval
== DE_SAMEFILE
, "Expected DE_SAMEFILE, got %d\n", retval
);
1230 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
1232 ok(!shfo
.fAnyOperationsAborted
, "Expected no operations to be aborted\n");
1233 ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
1235 /* destination is same as source directory */
1236 shfo
.pFrom
= "test1.txt\0test4.txt\0test3.txt\0";
1237 shfo
.pTo
= "b.txt\0test4.txt\0c.txt\0";
1238 shfo
.fAnyOperationsAborted
= FALSE
;
1239 retval
= SHFileOperation(&shfo
);
1240 if (retval
== DE_OPCANCELLED
)
1242 /* NT4 fails and doesn't copy any files */
1243 ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
1247 ok(retval
== ERROR_SUCCESS
||
1248 retval
== DE_DESTSAMETREE
, /* Vista */
1249 "Expected ERROR_SUCCESS or DE_DESTSAMETREE, got %d\n", retval
);
1250 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
1252 ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
1254 /* copy a directory into itself, error displayed in UI */
1255 shfo
.pFrom
= "test4.txt\0";
1256 shfo
.pTo
= "test4.txt\\newdir\0";
1257 shfo
.fFlags
&= ~FOF_MULTIDESTFILES
;
1258 shfo
.fAnyOperationsAborted
= FALSE
;
1259 retval
= SHFileOperation(&shfo
);
1260 ok(retval
== ERROR_SUCCESS
||
1261 retval
== DE_DESTSUBTREE
, /* Vista */
1262 "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval
);
1263 ok(!RemoveDirectory("test4.txt\\newdir"), "Expected test4.txt\\newdir to not exist\n");
1265 /* copy a directory to itself, error displayed in UI */
1266 shfo
.pFrom
= "test4.txt\0";
1267 shfo
.pTo
= "test4.txt\0";
1268 shfo
.fAnyOperationsAborted
= FALSE
;
1269 retval
= SHFileOperation(&shfo
);
1270 ok(retval
== ERROR_SUCCESS
||
1271 retval
== DE_DESTSUBTREE
, /* Vista */
1272 "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval
);
1274 /* copy a file into a directory, and the directory into itself */
1275 shfo
.pFrom
= "test1.txt\0test4.txt\0";
1276 shfo
.pTo
= "test4.txt\0";
1277 shfo
.fAnyOperationsAborted
= FALSE
;
1278 shfo
.fFlags
|= FOF_NOCONFIRMATION
;
1279 retval
= SHFileOperation(&shfo
);
1280 ok(retval
== ERROR_SUCCESS
||
1281 retval
== DE_DESTSUBTREE
, /* Vista */
1282 "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval
);
1283 ok(DeleteFile("test4.txt\\test1.txt"), "Expected test4.txt\\test1.txt to exist\n");
1285 /* copy a file to a file, and the directory into itself */
1286 shfo
.pFrom
= "test1.txt\0test4.txt\0";
1287 shfo
.pTo
= "test4.txt\\a.txt\0";
1288 shfo
.fAnyOperationsAborted
= FALSE
;
1289 retval
= SHFileOperation(&shfo
);
1290 if (dir_exists("test4.txt\\a.txt"))
1292 /* Vista and W2K8 (broken or new behavior ?) */
1293 ok(retval
== DE_DESTSUBTREE
, "Expected DE_DESTSUBTREE, got %d\n", retval
);
1294 ok(DeleteFile("test4.txt\\a.txt\\test1.txt"), "Expected test4.txt\\a.txt\\test1.txt to exist\n");
1295 RemoveDirectory("test4.txt\\a.txt");
1299 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1300 ok(!file_exists("test4.txt\\a.txt"), "Expected test4.txt\\a.txt to not exist\n");
1303 /* copy a nonexistent file to a nonexistent directory */
1304 shfo
.pFrom
= "e.txt\0";
1305 shfo
.pTo
= "nonexistent\0";
1306 shfo
.fAnyOperationsAborted
= FALSE
;
1307 retval
= SHFileOperation(&shfo
);
1308 ok(retval
== 1026 ||
1309 retval
== ERROR_FILE_NOT_FOUND
|| /* Vista */
1310 broken(retval
== ERROR_SUCCESS
), /* NT4 */
1311 "Expected 1026 or ERROR_FILE_NOT_FOUND, got %d\n", retval
);
1312 ok(!file_exists("nonexistent\\e.txt"), "Expected nonexistent\\e.txt to not exist\n");
1313 ok(!file_exists("nonexistent"), "Expected nonexistent to not exist\n");
1315 /* Overwrite tests */
1316 clean_after_shfo_tests();
1320 /* NT4 would throw up some dialog boxes and doesn't copy files that are needed
1321 * in subsequent tests.
1323 shfo
.fFlags
= FOF_NOCONFIRMATION
;
1324 shfo
.pFrom
= "test1.txt\0";
1325 shfo
.pTo
= "test2.txt\0";
1326 shfo
.fAnyOperationsAborted
= FALSE
;
1327 /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
1328 retval
= SHFileOperation(&shfo
);
1329 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1330 ok(file_has_content("test2.txt", "test1.txt\n"), "The file was not copied\n");
1332 shfo
.pFrom
= "test3.txt\0test1.txt\0";
1333 shfo
.pTo
= "test2.txt\0one.txt\0";
1334 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_MULTIDESTFILES
;
1335 /* without FOF_NOCONFIRMATION the confirmation is Yes/Yes to All/No/Cancel */
1336 retval
= SHFileOperation(&shfo
);
1337 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1338 ok(file_has_content("test2.txt", "test3.txt\n"), "The file was not copied\n");
1340 shfo
.pFrom
= "one.txt\0";
1341 shfo
.pTo
= "testdir2\0";
1342 shfo
.fFlags
= FOF_NOCONFIRMATION
;
1343 /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
1344 retval
= SHFileOperation(&shfo
);
1345 ok(retval
== 0, "Expected 0, got %d\n", retval
);
1346 ok(file_has_content("testdir2\\one.txt", "test1.txt\n"), "The file was not copied\n");
1349 createTestFile("test4.txt\\test1.txt");
1350 shfo
.pFrom
= "test4.txt\0";
1351 shfo
.pTo
= "testdir2\0";
1352 shfo
.fFlags
= FOF_NOCONFIRMATION
;
1353 ok(!SHFileOperation(&shfo
), "First SHFileOperation failed\n");
1354 createTestFile("test4.txt\\.\\test1.txt"); /* modify the content of the file */
1355 /* without FOF_NOCONFIRMATION the confirmation is "This folder already contains a folder named ..." */
1356 retval
= SHFileOperation(&shfo
);
1357 ok(retval
== 0, "Expected 0, got %d\n", retval
);
1358 ok(file_has_content("testdir2\\test4.txt\\test1.txt", "test4.txt\\.\\test1.txt\n"), "The file was not copied\n");
1360 createTestFile("one.txt");
1362 /* pFrom contains bogus 2nd name longer than MAX_PATH */
1363 memset(from
, 'a', MAX_PATH
*2);
1364 memset(from
+MAX_PATH
*2, 0, 2);
1365 lstrcpyA(from
, "one.txt");
1367 shfo
.pTo
= "two.txt\0";
1368 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1369 retval
= SHFileOperation(&shfo
);
1370 ok(retval
== 1148 || retval
== 1026 ||
1371 retval
== ERROR_ACCESS_DENIED
|| /* win2k */
1372 retval
== DE_INVALIDFILES
, /* Vista */
1373 "Unexpected return value, got %d\n", retval
);
1374 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1375 if (dir_exists("two.txt"))
1376 /* Vista and W2K8 (broken or new behavior ?) */
1377 ok(RemoveDirectory("two.txt"), "Expected two.txt to exist\n");
1379 ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
1381 createTestFile("one.txt");
1383 /* pTo contains bogus 2nd name longer than MAX_PATH */
1384 memset(to
, 'a', MAX_PATH
*2);
1385 memset(to
+MAX_PATH
*2, 0, 2);
1386 lstrcpyA(to
, "two.txt");
1387 shfo
.pFrom
= "one.txt\0";
1389 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1390 retval
= SHFileOperation(&shfo
);
1391 if (retval
== DE_OPCANCELLED
)
1393 /* NT4 fails and doesn't copy any files */
1394 ok(!file_exists("two.txt"), "Expected two.txt to not exist\n");
1398 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1399 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1401 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1403 createTestFile("one.txt");
1405 /* no FOF_MULTIDESTFILES, two files in pTo */
1406 shfo
.pFrom
= "one.txt\0";
1407 shfo
.pTo
= "two.txt\0three.txt\0";
1408 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1409 retval
= SHFileOperation(&shfo
);
1410 if (retval
== DE_OPCANCELLED
)
1412 /* NT4 fails and doesn't copy any files */
1413 ok(!file_exists("two.txt"), "Expected two.txt to not exist\n");
1417 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1418 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1420 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1422 createTestFile("one.txt");
1424 /* both pFrom and pTo contain bogus 2nd names longer than MAX_PATH */
1425 memset(from
, 'a', MAX_PATH
*2);
1426 memset(from
+MAX_PATH
*2, 0, 2);
1427 memset(to
, 'a', MAX_PATH
*2);
1428 memset(to
+MAX_PATH
*2, 0, 2);
1429 lstrcpyA(from
, "one.txt");
1430 lstrcpyA(to
, "two.txt");
1433 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1434 retval
= SHFileOperation(&shfo
);
1435 ok(retval
== 1148 || retval
== 1026 ||
1436 retval
== ERROR_ACCESS_DENIED
|| /* win2k */
1437 retval
== DE_INVALIDFILES
, /* Vista */
1438 "Unexpected return value, got %d\n", retval
);
1439 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1440 if (dir_exists("two.txt"))
1441 /* Vista and W2K8 (broken or new behavior ?) */
1442 ok(RemoveDirectory("two.txt"), "Expected two.txt to exist\n");
1444 ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
1446 createTestFile("one.txt");
1448 /* pTo contains bogus 2nd name longer than MAX_PATH, FOF_MULTIDESTFILES */
1449 memset(to
, 'a', MAX_PATH
*2);
1450 memset(to
+MAX_PATH
*2, 0, 2);
1451 lstrcpyA(to
, "two.txt");
1452 shfo
.pFrom
= "one.txt\0";
1454 shfo
.fFlags
= FOF_MULTIDESTFILES
| FOF_NOCONFIRMATION
|
1455 FOF_SILENT
| FOF_NOERRORUI
;
1456 retval
= SHFileOperation(&shfo
);
1457 if (retval
== DE_OPCANCELLED
)
1459 /* NT4 fails and doesn't copy any files */
1460 ok(!file_exists("two.txt"), "Expected two.txt to not exist\n");
1464 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1465 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1467 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1469 createTestFile("one.txt");
1470 createTestFile("two.txt");
1472 /* pTo contains bogus 2nd name longer than MAX_PATH,
1473 * multiple source files,
1474 * dest directory does not exist
1476 memset(to
, 'a', 2 * MAX_PATH
);
1477 memset(to
+MAX_PATH
*2, 0, 2);
1478 lstrcpyA(to
, "threedir");
1479 shfo
.pFrom
= "one.txt\0two.txt\0";
1481 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1482 retval
= SHFileOperation(&shfo
);
1483 if (dir_exists("threedir"))
1485 /* Vista and W2K8 (broken or new behavior ?) */
1486 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1487 ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
1488 ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
1489 ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
1493 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1494 ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
1495 ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
1496 ok(!DeleteFileA("threedir"), "Expected file to not exist\n");
1497 ok(!RemoveDirectoryA("threedir"), "Expected dir to not exist\n");
1499 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1500 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1502 createTestFile("one.txt");
1503 createTestFile("two.txt");
1504 CreateDirectoryA("threedir", NULL
);
1506 /* pTo contains bogus 2nd name longer than MAX_PATH,
1507 * multiple source files,
1508 * dest directory does exist
1510 memset(to
, 'a', 2 * MAX_PATH
);
1511 memset(to
+MAX_PATH
*2, 0, 2);
1512 lstrcpyA(to
, "threedir");
1513 shfo
.pFrom
= "one.txt\0two.txt\0";
1515 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1516 retval
= SHFileOperation(&shfo
);
1517 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1518 ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
1519 ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
1520 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1521 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1522 ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
1525 /* this crashes on win9x */
1526 createTestFile("one.txt");
1527 createTestFile("two.txt");
1529 /* pTo contains bogus 2nd name longer than MAX_PATH,
1530 * multiple source files, FOF_MULTIDESTFILES
1531 * dest dir does not exist
1534 memset(to
, 'a', 2 * MAX_PATH
);
1535 memset(to
+MAX_PATH
*2, 0, 2);
1536 lstrcpyA(to
, "threedir");
1537 shfo
.pFrom
= "one.txt\0two.txt\0";
1539 shfo
.fFlags
= FOF_MULTIDESTFILES
| FOF_NOCONFIRMATION
|
1540 FOF_SILENT
| FOF_NOERRORUI
;
1541 retval
= SHFileOperation(&shfo
);
1542 ok(retval
== ERROR_CANCELLED
||
1543 retval
== ERROR_SUCCESS
, /* win2k3 */
1544 "Expected ERROR_CANCELLED or ERROR_SUCCESS, got %d\n", retval
);
1545 ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
1546 ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
1547 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1548 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1549 ok(!RemoveDirectoryA("threedir"), "Expected dir to not exist\n");
1551 /* file exists in win2k */
1552 DeleteFileA("threedir");
1556 createTestFile("one.txt");
1557 createTestFile("two.txt");
1558 CreateDirectoryA("threedir", NULL
);
1560 /* pTo contains bogus 2nd name longer than MAX_PATH,
1561 * multiple source files, FOF_MULTIDESTFILES
1562 * dest dir does exist
1564 memset(to
, 'a', 2 * MAX_PATH
);
1565 memset(to
+MAX_PATH
*2, 0, 2);
1566 lstrcpyA(to
, "threedir");
1567 ptr
= to
+ lstrlenA(to
) + 1;
1568 lstrcpyA(ptr
, "fourdir");
1569 shfo
.pFrom
= "one.txt\0two.txt\0";
1571 shfo
.fFlags
= FOF_MULTIDESTFILES
| FOF_NOCONFIRMATION
|
1572 FOF_SILENT
| FOF_NOERRORUI
;
1573 retval
= SHFileOperation(&shfo
);
1574 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1575 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1576 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1577 ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
1578 if (dir_exists("fourdir"))
1580 /* Vista and W2K8 (broken or new behavior ?) */
1581 ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
1582 ok(DeleteFileA("fourdir\\two.txt"), "Expected file to exist\n");
1583 RemoveDirectoryA("fourdir");
1587 ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
1588 ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
1589 ok(!RemoveDirectoryA("fourdir"), "Expected dir to not exist\n");
1591 ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
1593 createTestFile("one.txt");
1594 createTestFile("two.txt");
1595 CreateDirectoryA("threedir", NULL
);
1597 /* multiple source files, FOF_MULTIDESTFILES
1598 * multiple dest files, but first dest dir exists
1599 * num files in lists is equal
1601 shfo
.pFrom
= "one.txt\0two.txt\0";
1602 shfo
.pTo
= "threedir\0fourdir\0";
1603 shfo
.fFlags
= FOF_MULTIDESTFILES
| FOF_NOCONFIRMATION
|
1604 FOF_SILENT
| FOF_NOERRORUI
;
1605 retval
= SHFileOperation(&shfo
);
1606 ok(retval
== ERROR_CANCELLED
||
1607 retval
== DE_FILEDESTISFLD
|| /* Vista */
1608 broken(retval
== DE_OPCANCELLED
), /* Win9x, NT4 */
1609 "Expected ERROR_CANCELLED or DE_FILEDESTISFLD. got %d\n", retval
);
1610 if (file_exists("threedir\\threedir"))
1613 ok(DeleteFileA("threedir\\threedir"), "Expected file to exist\n");
1615 ok(!DeleteFileA("threedir\\one.txt"), "Expected file to not exist\n");
1616 ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
1617 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1618 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1619 ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
1620 ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
1621 ok(!RemoveDirectoryA("fourdir"), "Expected dir to not exist\n");
1623 createTestFile("one.txt");
1624 createTestFile("two.txt");
1625 CreateDirectoryA("threedir", NULL
);
1627 /* multiple source files, FOF_MULTIDESTFILES
1628 * multiple dest files, but first dest dir exists
1629 * num files in lists is not equal
1631 shfo
.pFrom
= "one.txt\0two.txt\0";
1632 shfo
.pTo
= "threedir\0fourdir\0five\0";
1633 shfo
.fFlags
= FOF_MULTIDESTFILES
| FOF_NOCONFIRMATION
|
1634 FOF_SILENT
| FOF_NOERRORUI
;
1635 retval
= SHFileOperation(&shfo
);
1636 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1637 ok(DeleteFileA("one.txt"), "Expected file to exist\n");
1638 ok(DeleteFileA("two.txt"), "Expected file to exist\n");
1639 ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
1640 if (dir_exists("fourdir"))
1642 /* Vista and W2K8 (broken or new behavior ?) */
1643 ok(!DeleteFileA("threedir\\two.txt"), "Expected file to not exist\n");
1644 ok(DeleteFileA("fourdir\\two.txt"), "Expected file to exist\n");
1645 RemoveDirectoryA("fourdir");
1649 ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
1650 ok(!DeleteFileA("fourdir"), "Expected file to not exist\n");
1651 ok(!RemoveDirectoryA("fourdir"), "Expected dit to not exist\n");
1653 ok(RemoveDirectoryA("threedir"), "Expected dir to exist\n");
1654 ok(!DeleteFileA("five"), "Expected file to not exist\n");
1655 ok(!RemoveDirectoryA("five"), "Expected dit to not exist\n");
1657 createTestFile("aa.txt");
1658 createTestFile("ab.txt");
1659 CreateDirectoryA("one", NULL
);
1660 CreateDirectoryA("two", NULL
);
1662 /* pFrom has a glob, pTo has more than one dest */
1663 shfo
.pFrom
= "a*.txt\0";
1664 shfo
.pTo
= "one\0two\0";
1665 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1666 retval
= SHFileOperation(&shfo
);
1667 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1668 ok(DeleteFileA("one\\aa.txt"), "Expected file to exist\n");
1669 ok(DeleteFileA("one\\ab.txt"), "Expected file to exist\n");
1670 ok(!DeleteFileA("two\\aa.txt"), "Expected file to not exist\n");
1671 ok(!DeleteFileA("two\\ab.txt"), "Expected file to not exist\n");
1672 ok(DeleteFileA("aa.txt"), "Expected file to exist\n");
1673 ok(DeleteFileA("ab.txt"), "Expected file to exist\n");
1674 ok(RemoveDirectoryA("one"), "Expected dir to exist\n");
1675 ok(RemoveDirectoryA("two"), "Expected dir to exist\n");
1678 /* tests the FO_MOVE action */
1679 static void test_move(void)
1681 SHFILEOPSTRUCTA shfo
, shfo2
;
1682 CHAR from
[5*MAX_PATH
];
1683 CHAR to
[5*MAX_PATH
];
1687 shfo
.wFunc
= FO_MOVE
;
1690 shfo
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
1691 shfo
.hNameMappings
= NULL
;
1692 shfo
.lpszProgressTitle
= NULL
;
1694 set_curr_dir_path(from
, "test1.txt\0");
1695 set_curr_dir_path(to
, "test4.txt\0");
1696 ok(!SHFileOperationA(&shfo
), "Prepare test to check how directories are moved recursively\n");
1697 ok(!file_exists("test1.txt"), "test1.txt should not exist\n");
1698 ok(file_exists("test4.txt\\test1.txt"), "The file is not moved\n");
1700 set_curr_dir_path(from
, "test?.txt\0");
1701 set_curr_dir_path(to
, "testdir2\0");
1702 ok(!file_exists("testdir2\\test2.txt"), "The file is not moved yet\n");
1703 ok(!file_exists("testdir2\\test4.txt"), "The directory is not moved yet\n");
1704 ok(!SHFileOperationA(&shfo
), "Files and directories are moved to directory\n");
1705 ok(file_exists("testdir2\\test2.txt"), "The file is moved\n");
1706 ok(file_exists("testdir2\\test4.txt"), "The directory is moved\n");
1707 ok(file_exists("testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved\n");
1709 clean_after_shfo_tests();
1712 memcpy(&shfo2
, &shfo
, sizeof(SHFILEOPSTRUCTA
));
1713 shfo2
.fFlags
|= FOF_MULTIDESTFILES
;
1715 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
1716 set_curr_dir_path(to
, "test6.txt\0test7.txt\0test8.txt\0");
1717 ok(!SHFileOperationA(&shfo2
), "Move many files\n");
1718 ok(DeleteFileA("test6.txt"), "The file is not moved - many files are "
1719 "specified as a target\n");
1720 ok(DeleteFileA("test7.txt"), "The file is not moved\n");
1721 ok(RemoveDirectoryA("test8.txt"), "The directory is not moved\n");
1725 /* number of sources do not correspond to number of targets */
1726 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
1727 set_curr_dir_path(to
, "test6.txt\0test7.txt\0");
1728 retval
= SHFileOperationA(&shfo2
);
1729 if (dir_exists("test6.txt"))
1731 /* Vista and W2K8 (broken or new behavior ?) */
1732 ok(retval
== DE_DESTSAMETREE
, "Expected DE_DESTSAMETREE, got %d\n", retval
);
1733 ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n");
1734 RemoveDirectoryA("test6.txt");
1735 ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n");
1736 RemoveDirectoryA("test7.txt");
1740 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1741 ok(!file_exists("test6.txt"), "The file is not moved - many files are "
1742 "specified as a target\n");
1747 set_curr_dir_path(from
, "test3.txt\0");
1748 set_curr_dir_path(to
, "test4.txt\\test1.txt\0");
1749 ok(!SHFileOperationA(&shfo
), "Can't move file to other directory\n");
1750 ok(file_exists("test4.txt\\test1.txt"), "The file is not moved\n");
1752 set_curr_dir_path(from
, "test1.txt\0test2.txt\0test4.txt\0");
1753 set_curr_dir_path(to
, "test6.txt\0test7.txt\0test8.txt\0");
1754 retval
= SHFileOperationA(&shfo
);
1755 if (dir_exists("test6.txt"))
1757 /* Vista and W2K8 (broken or new behavior ?) */
1758 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1759 ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved. Many files are specified\n");
1760 ok(DeleteFileA("test6.txt\\test2.txt"), "The file is not moved. Many files are specified\n");
1761 ok(DeleteFileA("test6.txt\\test4.txt\\test1.txt"), "The file is not moved. Many files are specified\n");
1762 ok(RemoveDirectoryA("test6.txt\\test4.txt"), "The directory is not moved. Many files are specified\n");
1763 RemoveDirectoryA("test6.txt");
1768 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1769 ok(file_exists("test1.txt"), "The file is moved. Many files are specified\n");
1770 ok(dir_exists("test4.txt"), "The directory is moved. Many files are specified\n");
1773 set_curr_dir_path(from
, "test1.txt\0");
1774 set_curr_dir_path(to
, "test6.txt\0");
1775 ok(!SHFileOperationA(&shfo
), "Move file failed\n");
1776 ok(!file_exists("test1.txt"), "The file is not moved\n");
1777 ok(file_exists("test6.txt"), "The file is not moved\n");
1778 set_curr_dir_path(from
, "test6.txt\0");
1779 set_curr_dir_path(to
, "test1.txt\0");
1780 ok(!SHFileOperationA(&shfo
), "Move file back failed\n");
1782 set_curr_dir_path(from
, "test4.txt\0");
1783 set_curr_dir_path(to
, "test6.txt\0");
1784 ok(!SHFileOperationA(&shfo
), "Move dir failed\n");
1785 ok(!dir_exists("test4.txt"), "The dir is not moved\n");
1786 ok(dir_exists("test6.txt"), "The dir is moved\n");
1787 set_curr_dir_path(from
, "test6.txt\0");
1788 set_curr_dir_path(to
, "test4.txt\0");
1789 ok(!SHFileOperationA(&shfo
), "Move dir back failed\n");
1791 /* move one file to two others */
1793 shfo
.pFrom
= "test1.txt\0";
1794 shfo
.pTo
= "a.txt\0b.txt\0";
1795 retval
= SHFileOperationA(&shfo
);
1796 if (retval
== DE_OPCANCELLED
)
1798 /* NT4 fails and doesn't move any files */
1799 ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
1800 DeleteFileA("test1.txt");
1804 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1805 ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
1806 ok(DeleteFile("a.txt"), "Expected a.txt to exist\n");
1808 ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
1810 /* move two files to one other */
1811 shfo
.pFrom
= "test2.txt\0test3.txt\0";
1812 shfo
.pTo
= "test1.txt\0";
1813 retval
= SHFileOperationA(&shfo
);
1814 if (dir_exists("test1.txt"))
1816 /* Vista and W2K8 (broken or new behavior ?) */
1817 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1818 ok(DeleteFileA("test1.txt\\test2.txt"), "Expected test1.txt\\test2.txt to exist\n");
1819 ok(DeleteFileA("test1.txt\\test3.txt"), "Expected test1.txt\\test3.txt to exist\n");
1820 RemoveDirectoryA("test1.txt");
1821 createTestFile("test2.txt");
1822 createTestFile("test3.txt");
1826 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1827 ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
1828 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
1829 ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
1832 /* move a directory into itself */
1833 shfo
.pFrom
= "test4.txt\0";
1834 shfo
.pTo
= "test4.txt\\b.txt\0";
1835 retval
= SHFileOperationA(&shfo
);
1836 ok(retval
== ERROR_SUCCESS
||
1837 retval
== DE_DESTSUBTREE
, /* Vista */
1838 "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval
);
1839 ok(!RemoveDirectory("test4.txt\\b.txt"), "Expected test4.txt\\b.txt to not exist\n");
1840 ok(dir_exists("test4.txt"), "Expected test4.txt to exist\n");
1842 /* move many files without FOF_MULTIDESTFILES */
1843 shfo
.pFrom
= "test2.txt\0test3.txt\0";
1844 shfo
.pTo
= "d.txt\0e.txt\0";
1845 retval
= SHFileOperationA(&shfo
);
1846 if (dir_exists("d.txt"))
1848 /* Vista and W2K8 (broken or new behavior ?) */
1849 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1850 ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
1851 ok(DeleteFileA("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to exist\n");
1852 RemoveDirectoryA("d.txt");
1853 createTestFile("test2.txt");
1854 createTestFile("test3.txt");
1858 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1859 ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
1860 ok(!DeleteFile("e.txt"), "Expected e.txt to not exist\n");
1863 /* number of sources != number of targets */
1864 shfo
.pTo
= "d.txt\0";
1865 shfo
.fFlags
|= FOF_MULTIDESTFILES
;
1866 retval
= SHFileOperationA(&shfo
);
1867 if (dir_exists("d.txt"))
1869 /* Vista and W2K8 (broken or new behavior ?) */
1870 ok(retval
== DE_SAMEFILE
,
1871 "Expected DE_SAMEFILE, got %d\n", retval
);
1872 ok(DeleteFileA("d.txt\\test2.txt"), "Expected d.txt\\test2.txt to exist\n");
1873 ok(!file_exists("d.txt\\test3.txt"), "Expected d.txt\\test3.txt to not exist\n");
1874 RemoveDirectoryA("d.txt");
1875 createTestFile("test2.txt");
1879 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1880 ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
1883 /* FO_MOVE does not create dest directories */
1884 shfo
.pFrom
= "test2.txt\0";
1885 shfo
.pTo
= "dir1\\dir2\\test2.txt\0";
1886 retval
= SHFileOperationA(&shfo
);
1887 if (dir_exists("dir1"))
1889 /* Vista and W2K8 (broken or new behavior ?) */
1890 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1891 ok(DeleteFileA("dir1\\dir2\\test2.txt"), "Expected dir1\\dir2\\test2.txt to exist\n");
1892 RemoveDirectoryA("dir1\\dir2");
1893 RemoveDirectoryA("dir1");
1894 createTestFile("test2.txt");
1898 expect_retval(ERROR_CANCELLED
, DE_OPCANCELLED
/* Win9x, NT4 */);
1901 /* try to overwrite an existing file */
1902 shfo
.pTo
= "test3.txt\0";
1903 retval
= SHFileOperationA(&shfo
);
1904 if (retval
== DE_OPCANCELLED
)
1906 /* NT4 fails and doesn't move any files */
1907 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
1911 ok(retval
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", retval
);
1912 ok(!file_exists("test2.txt"), "Expected test2.txt to not exist\n");
1913 ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
1917 static void test_sh_create_dir(void)
1919 CHAR path
[MAX_PATH
];
1922 if(!pSHCreateDirectoryExA
)
1924 win_skip("skipping SHCreateDirectoryExA tests\n");
1928 set_curr_dir_path(path
, "testdir2\\test4.txt\0");
1929 ret
= pSHCreateDirectoryExA(NULL
, path
, NULL
);
1930 ok(ERROR_SUCCESS
== ret
, "SHCreateDirectoryEx failed to create directory recursively, ret = %d\n", ret
);
1931 ok(file_exists("testdir2"), "The first directory is not created\n");
1932 ok(file_exists("testdir2\\test4.txt"), "The second directory is not created\n");
1934 ret
= pSHCreateDirectoryExA(NULL
, path
, NULL
);
1935 ok(ERROR_ALREADY_EXISTS
== ret
, "SHCreateDirectoryEx should fail to create existing directory, ret = %d\n", ret
);
1937 ret
= pSHCreateDirectoryExA(NULL
, "c:\\testdir3", NULL
);
1938 ok(file_exists("c:\\testdir3"), "The directory is not created\n");
1941 static void test_sh_path_prepare(void)
1944 CHAR path
[MAX_PATH
];
1946 if(!pSHPathPrepareForWriteA
)
1948 win_skip("skipping SHPathPrepareForWriteA tests\n");
1952 /* directory exists, SHPPFW_NONE */
1953 set_curr_dir_path(path
, "testdir2\0");
1954 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_NONE
);
1955 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
1957 /* directory exists, SHPPFW_IGNOREFILENAME */
1958 set_curr_dir_path(path
, "testdir2\\test4.txt\0");
1959 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_IGNOREFILENAME
);
1960 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
1962 /* directory exists, SHPPFW_DIRCREATE */
1963 set_curr_dir_path(path
, "testdir2\0");
1964 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_DIRCREATE
);
1965 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
1967 /* directory exists, SHPPFW_IGNOREFILENAME|SHPPFW_DIRCREATE */
1968 set_curr_dir_path(path
, "testdir2\\test4.txt\0");
1969 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_IGNOREFILENAME
|SHPPFW_DIRCREATE
);
1970 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
1971 ok(!file_exists("nonexistent\\"), "nonexistent\\ exists but shouldn't\n");
1973 /* file exists, SHPPFW_NONE */
1974 set_curr_dir_path(path
, "test1.txt\0");
1975 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_NONE
);
1976 ok(res
== HRESULT_FROM_WIN32(ERROR_DIRECTORY
) ||
1977 res
== HRESULT_FROM_WIN32(ERROR_INVALID_NAME
), /* Vista */
1978 "Unexpected result : 0x%08x\n", res
);
1980 /* file exists, SHPPFW_DIRCREATE */
1981 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_DIRCREATE
);
1982 ok(res
== HRESULT_FROM_WIN32(ERROR_DIRECTORY
) ||
1983 res
== HRESULT_FROM_WIN32(ERROR_INVALID_NAME
), /* Vista */
1984 "Unexpected result : 0x%08x\n", res
);
1986 /* file exists, SHPPFW_NONE, trailing \ */
1987 set_curr_dir_path(path
, "test1.txt\\\0");
1988 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_NONE
);
1989 ok(res
== HRESULT_FROM_WIN32(ERROR_DIRECTORY
) ||
1990 res
== HRESULT_FROM_WIN32(ERROR_INVALID_NAME
), /* Vista */
1991 "Unexpected result : 0x%08x\n", res
);
1993 /* relative path exists, SHPPFW_DIRCREATE */
1994 res
= pSHPathPrepareForWriteA(0, 0, ".\\testdir2", SHPPFW_DIRCREATE
);
1995 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
1997 /* relative path doesn't exist, SHPPFW_DIRCREATE -- Windows does not create the directory in this case */
1998 res
= pSHPathPrepareForWriteA(0, 0, ".\\testdir2\\test4.txt", SHPPFW_DIRCREATE
);
1999 ok(res
== HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
), "res == 0x%08x, expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)\n", res
);
2000 ok(!file_exists(".\\testdir2\\test4.txt\\"), ".\\testdir2\\test4.txt\\ exists but shouldn't\n");
2002 /* directory doesn't exist, SHPPFW_NONE */
2003 set_curr_dir_path(path
, "nonexistent\0");
2004 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_NONE
);
2005 ok(res
== HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
), "res == 0x%08x, expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)\n", res
);
2007 /* directory doesn't exist, SHPPFW_IGNOREFILENAME */
2008 set_curr_dir_path(path
, "nonexistent\\notreal\0");
2009 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_IGNOREFILENAME
);
2010 ok(res
== HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
), "res == 0x%08x, expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)\n", res
);
2011 ok(!file_exists("nonexistent\\notreal"), "nonexistent\\notreal exists but shouldn't\n");
2012 ok(!file_exists("nonexistent\\"), "nonexistent\\ exists but shouldn't\n");
2014 /* directory doesn't exist, SHPPFW_IGNOREFILENAME|SHPPFW_DIRCREATE */
2015 set_curr_dir_path(path
, "testdir2\\test4.txt\\\0");
2016 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_IGNOREFILENAME
|SHPPFW_DIRCREATE
);
2017 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
2018 ok(file_exists("testdir2\\test4.txt\\"), "testdir2\\test4.txt doesn't exist but should\n");
2020 /* nested directory doesn't exist, SHPPFW_DIRCREATE */
2021 set_curr_dir_path(path
, "nonexistent\\notreal\0");
2022 res
= pSHPathPrepareForWriteA(0, 0, path
, SHPPFW_DIRCREATE
);
2023 ok(res
== S_OK
, "res == 0x%08x, expected S_OK\n", res
);
2024 ok(file_exists("nonexistent\\notreal"), "nonexistent\\notreal doesn't exist but should\n");
2026 /* SHPPFW_ASKDIRCREATE, SHPPFW_NOWRITECHECK, and SHPPFW_MEDIACHECKONLY are untested */
2028 if(!pSHPathPrepareForWriteW
)
2030 skip("Skipping SHPathPrepareForWriteW tests\n");
2033 /* unicode directory doesn't exist, SHPPFW_NONE */
2034 res
= pSHPathPrepareForWriteW(0, 0, UNICODE_PATH
, SHPPFW_NONE
);
2035 ok(res
== HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
), "res == %08x, expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)\n", res
);
2036 ok(!file_existsW(UNICODE_PATH
), "unicode path was created but shouldn't be\n");
2037 RemoveDirectoryW(UNICODE_PATH
);
2039 /* unicode directory doesn't exist, SHPPFW_DIRCREATE */
2040 res
= pSHPathPrepareForWriteW(0, 0, UNICODE_PATH
, SHPPFW_DIRCREATE
);
2041 ok(res
== S_OK
, "res == %08x, expected S_OK\n", res
);
2042 ok(file_existsW(UNICODE_PATH
), "unicode path should've been created\n");
2044 /* unicode directory exists, SHPPFW_NONE */
2045 res
= pSHPathPrepareForWriteW(0, 0, UNICODE_PATH
, SHPPFW_NONE
);
2046 ok(res
== S_OK
, "ret == %08x, expected S_OK\n", res
);
2048 /* unicode directory exists, SHPPFW_DIRCREATE */
2049 res
= pSHPathPrepareForWriteW(0, 0, UNICODE_PATH
, SHPPFW_DIRCREATE
);
2050 ok(res
== S_OK
, "ret == %08x, expected S_OK\n", res
);
2051 RemoveDirectoryW(UNICODE_PATH
);
2054 static void test_sh_new_link_info(void)
2056 BOOL ret
, mustcopy
=TRUE
;
2057 CHAR linkto
[MAX_PATH
];
2058 CHAR destdir
[MAX_PATH
];
2059 CHAR result
[MAX_PATH
];
2060 CHAR result2
[MAX_PATH
];
2062 /* source file does not exist */
2063 set_curr_dir_path(linkto
, "nosuchfile.txt\0");
2064 set_curr_dir_path(destdir
, "testdir2\0");
2065 ret
= SHGetNewLinkInfoA(linkto
, destdir
, result
, &mustcopy
, 0);
2067 broken(ret
== lstrlenA(result
) + 1), /* NT4 */
2068 "SHGetNewLinkInfoA succeeded\n");
2069 ok(mustcopy
== FALSE
, "mustcopy should be FALSE\n");
2071 /* dest dir does not exist */
2072 set_curr_dir_path(linkto
, "test1.txt\0");
2073 set_curr_dir_path(destdir
, "nosuchdir\0");
2074 ret
= SHGetNewLinkInfoA(linkto
, destdir
, result
, &mustcopy
, 0);
2076 broken(ret
== lstrlenA(result
) + 1), /* NT4 */
2077 "SHGetNewLinkInfoA failed, err=%i\n", GetLastError());
2078 ok(mustcopy
== FALSE
, "mustcopy should be FALSE\n");
2080 /* source file exists */
2081 set_curr_dir_path(linkto
, "test1.txt\0");
2082 set_curr_dir_path(destdir
, "testdir2\0");
2083 ret
= SHGetNewLinkInfoA(linkto
, destdir
, result
, &mustcopy
, 0);
2085 broken(ret
== lstrlenA(result
) + 1), /* NT4 */
2086 "SHGetNewLinkInfoA failed, err=%i\n", GetLastError());
2087 ok(mustcopy
== FALSE
, "mustcopy should be FALSE\n");
2088 ok(CompareStringA(LOCALE_SYSTEM_DEFAULT
, NORM_IGNORECASE
, destdir
,
2089 lstrlenA(destdir
), result
, lstrlenA(destdir
)) == CSTR_EQUAL
,
2090 "%s does not start with %s\n", result
, destdir
);
2091 ok(lstrlenA(result
) > 4 && lstrcmpiA(result
+lstrlenA(result
)-4, ".lnk") == 0,
2092 "%s does not end with .lnk\n", result
);
2094 /* preferred target name already exists */
2095 createTestFile(result
);
2096 ret
= SHGetNewLinkInfoA(linkto
, destdir
, result2
, &mustcopy
, 0);
2098 broken(ret
== lstrlenA(result2
) + 1), /* NT4 */
2099 "SHGetNewLinkInfoA failed, err=%i\n", GetLastError());
2100 ok(mustcopy
== FALSE
, "mustcopy should be FALSE\n");
2101 ok(CompareStringA(LOCALE_SYSTEM_DEFAULT
, NORM_IGNORECASE
, destdir
,
2102 lstrlenA(destdir
), result2
, lstrlenA(destdir
)) == CSTR_EQUAL
,
2103 "%s does not start with %s\n", result2
, destdir
);
2104 ok(lstrlenA(result2
) > 4 && lstrcmpiA(result2
+lstrlenA(result2
)-4, ".lnk") == 0,
2105 "%s does not end with .lnk\n", result2
);
2106 ok(lstrcmpiA(result
, result2
) != 0, "%s and %s are the same\n", result
, result2
);
2107 DeleteFileA(result
);
2110 static void test_unicode(void)
2112 SHFILEOPSTRUCTW shfoW
;
2116 if (!pSHFileOperationW
)
2118 skip("SHFileOperationW() is missing\n");
2123 shfoW
.wFunc
= FO_DELETE
;
2124 shfoW
.pFrom
= UNICODE_PATH
;
2126 shfoW
.fFlags
= FOF_NOCONFIRMATION
| FOF_SILENT
| FOF_NOERRORUI
;
2127 shfoW
.hNameMappings
= NULL
;
2128 shfoW
.lpszProgressTitle
= NULL
;
2130 /* Clean up before start test */
2131 DeleteFileW(UNICODE_PATH
);
2132 RemoveDirectoryW(UNICODE_PATH
);
2134 /* Make sure we are on a system that supports unicode */
2135 SetLastError(0xdeadbeef);
2136 file
= CreateFileW(UNICODE_PATH
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
2137 if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED
)
2139 skip("Unicode tests skipped on non-unicode system\n");
2144 /* Try to delete a file with unicode filename */
2145 ok(file_existsW(UNICODE_PATH
), "The file does not exist\n");
2146 ret
= pSHFileOperationW(&shfoW
);
2147 ok(!ret
, "File is not removed, ErrorCode: %d\n", ret
);
2148 ok(!file_existsW(UNICODE_PATH
), "The file should have been removed\n");
2150 /* Try to trash a file with unicode filename */
2151 createTestFileW(UNICODE_PATH
);
2152 shfoW
.fFlags
|= FOF_ALLOWUNDO
;
2153 ok(file_existsW(UNICODE_PATH
), "The file does not exist\n");
2154 ret
= pSHFileOperationW(&shfoW
);
2155 ok(!ret
, "File is not removed, ErrorCode: %d\n", ret
);
2156 ok(!file_existsW(UNICODE_PATH
), "The file should have been removed\n");
2158 if(!pSHCreateDirectoryExW
)
2160 skip("Skipping SHCreateDirectoryExW tests\n");
2164 /* Try to delete a directory with unicode filename */
2165 ret
= pSHCreateDirectoryExW(NULL
, UNICODE_PATH
, NULL
);
2166 ok(!ret
, "SHCreateDirectoryExW returned %d\n", ret
);
2167 ok(file_existsW(UNICODE_PATH
), "The directory is not created\n");
2168 shfoW
.fFlags
&= ~FOF_ALLOWUNDO
;
2169 ret
= pSHFileOperationW(&shfoW
);
2170 ok(!ret
, "Directory is not removed, ErrorCode: %d\n", ret
);
2171 ok(!file_existsW(UNICODE_PATH
), "The directory should have been removed\n");
2173 /* Try to trash a directory with unicode filename */
2174 ret
= pSHCreateDirectoryExW(NULL
, UNICODE_PATH
, NULL
);
2175 ok(!ret
, "SHCreateDirectoryExW returned %d\n", ret
);
2176 ok(file_existsW(UNICODE_PATH
), "The directory was not created\n");
2177 shfoW
.fFlags
|= FOF_ALLOWUNDO
;
2178 ret
= pSHFileOperationW(&shfoW
);
2179 ok(!ret
, "Directory is not removed, ErrorCode: %d\n", ret
);
2180 ok(!file_existsW(UNICODE_PATH
), "The directory should have been removed\n");
2183 START_TEST(shlfileop
)
2185 InitFunctionPointers();
2187 clean_after_shfo_tests();
2190 test_get_file_info();
2191 test_get_file_info_iconlist();
2192 clean_after_shfo_tests();
2196 clean_after_shfo_tests();
2200 clean_after_shfo_tests();
2204 clean_after_shfo_tests();
2208 clean_after_shfo_tests();
2210 test_sh_create_dir();
2211 clean_after_shfo_tests();
2214 test_sh_path_prepare();
2215 clean_after_shfo_tests();
2218 test_sh_new_link_info();
2219 clean_after_shfo_tests();