1c2c66affSColin Finck /*
2c2c66affSColin Finck * PROJECT: ReactOS api tests
3c2c66affSColin Finck * LICENSE: GPLv2+ - See COPYING in the top level directory
4c2c66affSColin Finck * PURPOSE: Test for RtlDoesFileExists_U*
5c2c66affSColin Finck * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6c2c66affSColin Finck */
7c2c66affSColin Finck
8*283bbe73SAmine Khaldi #include "precomp.h"
9c2c66affSColin Finck
10c2c66affSColin Finck #define ok_bool_file(value, expected, file) do { \
11c2c66affSColin Finck if (expected) \
12c2c66affSColin Finck ok(value == TRUE, "File '%ls' should exist, but does not\n", file); \
13c2c66affSColin Finck else \
14c2c66affSColin Finck ok(value == FALSE, "File '%ls' should not exist, but does\n", file);\
15c2c66affSColin Finck } while (0)
16c2c66affSColin Finck
17c2c66affSColin Finck #define ok_eq_ustr(str1, str2) do { \
18c2c66affSColin Finck ok((str1)->Buffer == (str2)->Buffer, "Buffer modified\n"); \
19c2c66affSColin Finck ok((str1)->Length == (str2)->Length, "Length modified\n"); \
20c2c66affSColin Finck ok((str1)->MaximumLength == (str2)->MaximumLength, "MaximumLength modified\n"); \
21c2c66affSColin Finck } while (0)
22c2c66affSColin Finck
23c2c66affSColin Finck /*
24c2c66affSColin Finck BOOLEAN
25c2c66affSColin Finck NTAPI
26c2c66affSColin Finck RtlDoesFileExists_U(
27c2c66affSColin Finck IN PCWSTR FileName
28c2c66affSColin Finck );
29c2c66affSColin Finck
30c2c66affSColin Finck BOOLEAN
31c2c66affSColin Finck NTAPI
32c2c66affSColin Finck RtlDoesFileExists_UEx(
33c2c66affSColin Finck IN PCWSTR FileName,
34c2c66affSColin Finck IN BOOLEAN SucceedIfBusy
35c2c66affSColin Finck );
36c2c66affSColin Finck
37c2c66affSColin Finck BOOLEAN
38c2c66affSColin Finck NTAPI
39c2c66affSColin Finck RtlDoesFileExists_UStr(
40c2c66affSColin Finck IN PUNICODE_STRING FileName
41c2c66affSColin Finck );
42c2c66affSColin Finck
43c2c66affSColin Finck BOOLEAN
44c2c66affSColin Finck NTAPI
45c2c66affSColin Finck RtlDoesFileExists_UstrEx(
46c2c66affSColin Finck IN PCUNICODE_STRING FileName,
47c2c66affSColin Finck IN BOOLEAN SucceedIfBusy
48c2c66affSColin Finck );
49c2c66affSColin Finck */
50c2c66affSColin Finck
51c2c66affSColin Finck static
52c2c66affSColin Finck BOOLEAN
53c2c66affSColin Finck (NTAPI
54c2c66affSColin Finck *RtlDoesFileExists_UEx)(
55c2c66affSColin Finck IN PCWSTR FileName,
56c2c66affSColin Finck IN BOOLEAN SucceedIfBusy
57c2c66affSColin Finck )
58c2c66affSColin Finck //= (PVOID)0x7c8187d0 // 2003 sp1 x86
59c2c66affSColin Finck //= (PVOID)0x7769aeb2 // win7 sp1 wow64
60c2c66affSColin Finck ;
61c2c66affSColin Finck
62c2c66affSColin Finck static
63c2c66affSColin Finck BOOLEAN
64c2c66affSColin Finck (NTAPI
65c2c66affSColin Finck *RtlDoesFileExists_UStr)(
66c2c66affSColin Finck IN PUNICODE_STRING FileName
67c2c66affSColin Finck )
68c2c66affSColin Finck //= (PVOID)0x7c8474e5 // 2003 sp1 x86
69c2c66affSColin Finck //= (PVOID)0x776ff304 // win7 sp1 wow64
70c2c66affSColin Finck ;
71c2c66affSColin Finck
72c2c66affSColin Finck static
73c2c66affSColin Finck BOOLEAN
74c2c66affSColin Finck (NTAPI
75c2c66affSColin Finck *RtlDoesFileExists_UstrEx)(
76c2c66affSColin Finck IN PCUNICODE_STRING FileName,
77c2c66affSColin Finck IN BOOLEAN SucceedIfBusy
78c2c66affSColin Finck )
79c2c66affSColin Finck //= (PVOID)0x7c830f89 // 2003 sp1 x86
80c2c66affSColin Finck //= (PVOID)0x7769addb // win7 sp1 wow64
81c2c66affSColin Finck ;
82c2c66affSColin Finck
START_TEST(RtlDoesFileExists)83c2c66affSColin Finck START_TEST(RtlDoesFileExists)
84c2c66affSColin Finck {
85c2c66affSColin Finck BOOLEAN Ret;
86c2c66affSColin Finck struct
87c2c66affSColin Finck {
88c2c66affSColin Finck PCWSTR FileName;
89c2c66affSColin Finck BOOLEAN Exists;
90c2c66affSColin Finck } Tests[] =
91c2c66affSColin Finck {
92c2c66affSColin Finck { L"", FALSE },
93c2c66affSColin Finck { L"?", FALSE },
94c2c66affSColin Finck { L"*", FALSE },
95c2c66affSColin Finck { L":", FALSE },
96c2c66affSColin Finck { L";", FALSE },
97c2c66affSColin Finck { L"\"", FALSE },
98c2c66affSColin Finck { L".", TRUE },
99c2c66affSColin Finck { L"..", TRUE },
100c2c66affSColin Finck { L"/", TRUE },
101c2c66affSColin Finck { L"//", FALSE },
102c2c66affSColin Finck { L"///", FALSE },
103c2c66affSColin Finck { L"\\/", FALSE },
104c2c66affSColin Finck { L"\\//", FALSE },
105c2c66affSColin Finck { L"\\\\/", FALSE },
106c2c66affSColin Finck { L"\\/\\", FALSE },
107c2c66affSColin Finck { L"\\/\\\\", FALSE },
108c2c66affSColin Finck { L"\\/\\/\\", FALSE },
109c2c66affSColin Finck { L"\\", TRUE },
110c2c66affSColin Finck { L"\\\\", FALSE },
111c2c66affSColin Finck { L"\\\\\\", FALSE },
112c2c66affSColin Finck { L"\\\\.", FALSE },
113c2c66affSColin Finck { L"\\\\.\\", FALSE },
114c2c66affSColin Finck { L"\\\\.\\GLOBAL??", FALSE },
115c2c66affSColin Finck { L"\\\\.\\GLOBAL??\\", FALSE },
116c2c66affSColin Finck { L"\\\\?", FALSE },
117c2c66affSColin Finck { L"\\\\??", FALSE },
118c2c66affSColin Finck { L"\\\\??\\", FALSE },
119c2c66affSColin Finck { L"\\\\??\\C:\\", FALSE },
120c2c66affSColin Finck { L"\\\\.", FALSE },
121c2c66affSColin Finck { L"\\\\.\\", FALSE },
122c2c66affSColin Finck { L"C:", TRUE },
123c2c66affSColin Finck { L"C:/", TRUE },
124c2c66affSColin Finck { L"C:/\\", TRUE },
125c2c66affSColin Finck { L"C:\\/", TRUE },
126c2c66affSColin Finck { L"C:\\/\\", TRUE },
127c2c66affSColin Finck { L"C://", TRUE },
128c2c66affSColin Finck { L"C:\\", TRUE },
129c2c66affSColin Finck { L"C:\\\\", TRUE },
130c2c66affSColin Finck { L"C:\\%ls", TRUE },
131c2c66affSColin Finck { L"C:/%ls", TRUE },
132c2c66affSColin Finck { L"C://%ls", TRUE },
133c2c66affSColin Finck { L"C:\\/%ls", TRUE },
134c2c66affSColin Finck { L"C:/\\%ls", TRUE },
135c2c66affSColin Finck { L"C:\\/\\%ls", TRUE },
136c2c66affSColin Finck { L"C:\\%ls\\", TRUE },
137c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists", TRUE },
138c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\", TRUE },
139c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists ", TRUE },
140c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists ", TRUE },
141c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists ", TRUE },
142c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists:", FALSE },
143c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\t", FALSE },
144c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\n", FALSE },
145c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\r", FALSE },
146c2c66affSColin Finck { L" C:\\%ls\\ThisFolderExists", FALSE },
147c2c66affSColin Finck { L"C:\\%ls\\ ThisFolderExists", FALSE },
148c2c66affSColin Finck { L"C:\\%ls \\ThisFolderExists", FALSE },
149c2c66affSColin Finck { L"C:\\%ls\\ThisDoesntExist", FALSE },
150c2c66affSColin Finck { L"C:\\\\%ls\\\\ThisFolderExists", TRUE },
151c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\ThisFileExists", TRUE },
152c2c66affSColin Finck { L"c:\\%ls\\thisfolderexists\\thisfileexists", TRUE },
153c2c66affSColin Finck { L"C:\\%ls\\THISFOLDEREXISTS\\THISFILEEXISTS", TRUE },
154c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\SomeProgram.exe",TRUE },
155c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\SomeProgram", FALSE },
156c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\With", FALSE },
157c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\With Space", TRUE },
158c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\Without", TRUE },
159c2c66affSColin Finck { L"C:\\%ls\\ThisFolderExists\\Without Space", FALSE },
160c2c66affSColin Finck { L"C:\\%ls abc", FALSE },
161c2c66affSColin Finck { L"\"C:\\%ls\" abc", FALSE },
162c2c66affSColin Finck { L"\"C:\\\"", FALSE },
163c2c66affSColin Finck { L"C:\\%ls;C:\\", FALSE },
164c2c66affSColin Finck { L"%%SystemRoot%%", FALSE },
165c2c66affSColin Finck { L"%%SystemRoot%%\\", FALSE },
166c2c66affSColin Finck { L"%%SystemRoot%%\\system32", FALSE },
167c2c66affSColin Finck { L"NUL", FALSE },
168c2c66affSColin Finck { L"CON", FALSE },
169c2c66affSColin Finck { L"COM1", FALSE },
170c2c66affSColin Finck { L"\\?", FALSE },
171c2c66affSColin Finck { L"\\??", FALSE },
172c2c66affSColin Finck { L"\\??\\", FALSE },
173c2c66affSColin Finck { L"\\??\\C", FALSE },
174c2c66affSColin Finck { L"\\??\\C:", FALSE },
175c2c66affSColin Finck { L"\\??\\C:\\", FALSE }, // TRUE on Win7
176c2c66affSColin Finck { L"\\??\\C:\\%ls\\ThisFolderExists", FALSE }, // TRUE on Win7
177c2c66affSColin Finck };
178c2c66affSColin Finck ULONG i;
179c2c66affSColin Finck WCHAR FileName[MAX_PATH];
180c2c66affSColin Finck WCHAR CustomPath[MAX_PATH] = L"RtlDoesFileExists_U_TestPath";
181c2c66affSColin Finck BOOL Success;
182c2c66affSColin Finck HANDLE Handle;
183c2c66affSColin Finck
184c2c66affSColin Finck if (!RtlDoesFileExists_UEx)
185c2c66affSColin Finck {
186c2c66affSColin Finck RtlDoesFileExists_UEx = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlDoesFileExists_UEx");
187c2c66affSColin Finck if (!RtlDoesFileExists_UEx)
188c2c66affSColin Finck skip("RtlDoesFileExists_UEx unavailable\n");
189c2c66affSColin Finck }
190c2c66affSColin Finck
191c2c66affSColin Finck if (!RtlDoesFileExists_UStr)
192c2c66affSColin Finck {
193c2c66affSColin Finck RtlDoesFileExists_UStr = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlDoesFileExists_UStr");
194c2c66affSColin Finck if (!RtlDoesFileExists_UStr)
195c2c66affSColin Finck skip("RtlDoesFileExists_UStr unavailable\n");
196c2c66affSColin Finck }
197c2c66affSColin Finck
198c2c66affSColin Finck if (!RtlDoesFileExists_UstrEx)
199c2c66affSColin Finck {
200c2c66affSColin Finck RtlDoesFileExists_UstrEx = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlDoesFileExists_UstrEx");
201c2c66affSColin Finck if (!RtlDoesFileExists_UstrEx)
202c2c66affSColin Finck skip("RtlDoesFileExists_UstrEx unavailable\n");
203c2c66affSColin Finck }
204c2c66affSColin Finck
205c2c66affSColin Finck StartSeh()
206c2c66affSColin Finck Ret = RtlDoesFileExists_U(NULL);
207c2c66affSColin Finck ok(Ret == FALSE, "NULL file exists?!\n");
208c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
209c2c66affSColin Finck
210c2c66affSColin Finck if (RtlDoesFileExists_UEx)
211c2c66affSColin Finck {
212c2c66affSColin Finck StartSeh()
213c2c66affSColin Finck Ret = RtlDoesFileExists_UEx(NULL, TRUE);
214c2c66affSColin Finck ok(Ret == FALSE, "NULL file exists?!\n");
215c2c66affSColin Finck Ret = RtlDoesFileExists_UEx(NULL, FALSE);
216c2c66affSColin Finck ok(Ret == FALSE, "NULL file exists?!\n");
217c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
218c2c66affSColin Finck }
219c2c66affSColin Finck
220c2c66affSColin Finck if (RtlDoesFileExists_UStr)
221c2c66affSColin Finck {
222c2c66affSColin Finck StartSeh() Ret = RtlDoesFileExists_UStr(NULL); EndSeh(STATUS_ACCESS_VIOLATION);
223c2c66affSColin Finck }
224c2c66affSColin Finck
225c2c66affSColin Finck if (RtlDoesFileExists_UstrEx)
226c2c66affSColin Finck {
227c2c66affSColin Finck StartSeh() RtlDoesFileExists_UstrEx(NULL, FALSE); EndSeh(STATUS_ACCESS_VIOLATION);
228c2c66affSColin Finck StartSeh() RtlDoesFileExists_UstrEx(NULL, TRUE); EndSeh(STATUS_ACCESS_VIOLATION);
229c2c66affSColin Finck }
230c2c66affSColin Finck
231c2c66affSColin Finck swprintf(FileName, L"C:\\%ls", CustomPath);
232c2c66affSColin Finck /* Make sure this directory doesn't exist */
233c2c66affSColin Finck while (GetFileAttributesW(FileName) != INVALID_FILE_ATTRIBUTES)
234c2c66affSColin Finck {
235c2c66affSColin Finck wcscat(CustomPath, L"X");
236c2c66affSColin Finck swprintf(FileName, L"C:\\%ls", CustomPath);
237c2c66affSColin Finck }
238c2c66affSColin Finck Success = CreateDirectoryW(FileName, NULL);
239c2c66affSColin Finck ok(Success, "CreateDirectory failed, results might not be accurate\n");
240c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
241c2c66affSColin Finck Success = CreateDirectoryW(FileName, NULL);
242c2c66affSColin Finck ok(Success, "CreateDirectory failed, results might not be accurate\n");
243c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists", CustomPath);
244c2c66affSColin Finck Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
245c2c66affSColin Finck ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
246c2c66affSColin Finck if (Handle != INVALID_HANDLE_VALUE)
247c2c66affSColin Finck {
248c2c66affSColin Finck /* Check SucceedIfBusy behavior */
249c2c66affSColin Finck if (RtlDoesFileExists_UEx)
250c2c66affSColin Finck {
251c2c66affSColin Finck Ret = RtlDoesFileExists_UEx(FileName, TRUE);
252c2c66affSColin Finck ok_bool_file(Ret, TRUE, FileName);
253c2c66affSColin Finck /* TODO: apparently we have to do something worse to make this fail */
254c2c66affSColin Finck Ret = RtlDoesFileExists_UEx(FileName, FALSE);
255c2c66affSColin Finck ok_bool_file(Ret, TRUE, FileName);
256c2c66affSColin Finck }
257c2c66affSColin Finck if (RtlDoesFileExists_UstrEx)
258c2c66affSColin Finck {
259c2c66affSColin Finck UNICODE_STRING FileNameString;
260c2c66affSColin Finck UNICODE_STRING TempString;
261c2c66affSColin Finck RtlInitUnicodeString(&FileNameString, FileName);
262c2c66affSColin Finck TempString = FileNameString;
263c2c66affSColin Finck Ret = RtlDoesFileExists_UstrEx(&FileNameString, TRUE);
264c2c66affSColin Finck ok_eq_ustr(&FileNameString, &TempString);
265c2c66affSColin Finck ok_bool_file(Ret, TRUE, FileName);
266c2c66affSColin Finck /* TODO: apparently we have to do something worse to make this fail */
267c2c66affSColin Finck Ret = RtlDoesFileExists_UstrEx(&FileNameString, FALSE);
268c2c66affSColin Finck ok_eq_ustr(&FileNameString, &TempString);
269c2c66affSColin Finck ok_bool_file(Ret, TRUE, FileName);
270c2c66affSColin Finck }
271c2c66affSColin Finck CloseHandle(Handle);
272c2c66affSColin Finck }
273c2c66affSColin Finck
274c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\SomeProgram.exe", CustomPath);
275c2c66affSColin Finck Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
276c2c66affSColin Finck ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
277c2c66affSColin Finck if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle);
278c2c66affSColin Finck
279c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\With Space", CustomPath);
280c2c66affSColin Finck Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
281c2c66affSColin Finck ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
282c2c66affSColin Finck if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle);
283c2c66affSColin Finck
284c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\Without", CustomPath);
285c2c66affSColin Finck Handle = CreateFileW(FileName, 0, 0, NULL, CREATE_NEW, 0, NULL);
286c2c66affSColin Finck ok(Handle != INVALID_HANDLE_VALUE, "CreateFile failed, results might not be accurate\n");
287c2c66affSColin Finck if (Handle != INVALID_HANDLE_VALUE) CloseHandle(Handle);
288c2c66affSColin Finck
289c2c66affSColin Finck for (i = 0; i < sizeof(Tests) / sizeof(Tests[0]); i++)
290c2c66affSColin Finck {
291c2c66affSColin Finck swprintf(FileName, Tests[i].FileName, CustomPath);
292c2c66affSColin Finck StartSeh()
293c2c66affSColin Finck Ret = RtlDoesFileExists_U(FileName);
294c2c66affSColin Finck ok_bool_file(Ret, Tests[i].Exists, FileName);
295c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
296c2c66affSColin Finck if (RtlDoesFileExists_UEx)
297c2c66affSColin Finck {
298c2c66affSColin Finck StartSeh()
299c2c66affSColin Finck Ret = RtlDoesFileExists_UEx(FileName, TRUE);
300c2c66affSColin Finck ok_bool_file(Ret, Tests[i].Exists, FileName);
301c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
302c2c66affSColin Finck StartSeh()
303c2c66affSColin Finck Ret = RtlDoesFileExists_UEx(FileName, FALSE);
304c2c66affSColin Finck ok_bool_file(Ret, Tests[i].Exists, FileName);
305c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
306c2c66affSColin Finck }
307c2c66affSColin Finck /* TODO: use guarded memory to make sure these don't touch the null terminator */
308c2c66affSColin Finck if (RtlDoesFileExists_UStr)
309c2c66affSColin Finck {
310c2c66affSColin Finck UNICODE_STRING FileNameString;
311c2c66affSColin Finck UNICODE_STRING TempString;
312c2c66affSColin Finck RtlInitUnicodeString(&FileNameString, FileName);
313c2c66affSColin Finck TempString = FileNameString;
314c2c66affSColin Finck StartSeh()
315c2c66affSColin Finck Ret = RtlDoesFileExists_UStr(&FileNameString);
316c2c66affSColin Finck ok_bool_file(Ret, Tests[i].Exists, FileName);
317c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
318c2c66affSColin Finck ok_eq_ustr(&FileNameString, &TempString);
319c2c66affSColin Finck }
320c2c66affSColin Finck if (RtlDoesFileExists_UstrEx)
321c2c66affSColin Finck {
322c2c66affSColin Finck UNICODE_STRING FileNameString;
323c2c66affSColin Finck UNICODE_STRING TempString;
324c2c66affSColin Finck RtlInitUnicodeString(&FileNameString, FileName);
325c2c66affSColin Finck TempString = FileNameString;
326c2c66affSColin Finck StartSeh()
327c2c66affSColin Finck Ret = RtlDoesFileExists_UstrEx(&FileNameString, TRUE);
328c2c66affSColin Finck ok_bool_file(Ret, Tests[i].Exists, FileName);
329c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
330c2c66affSColin Finck ok_eq_ustr(&FileNameString, &TempString);
331c2c66affSColin Finck StartSeh()
332c2c66affSColin Finck Ret = RtlDoesFileExists_UstrEx(&FileNameString, FALSE);
333c2c66affSColin Finck ok_bool_file(Ret, Tests[i].Exists, FileName);
334c2c66affSColin Finck EndSeh(STATUS_SUCCESS);
335c2c66affSColin Finck ok_eq_ustr(&FileNameString, &TempString);
336c2c66affSColin Finck }
337c2c66affSColin Finck }
338c2c66affSColin Finck
339c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\Without", CustomPath);
340c2c66affSColin Finck Success = DeleteFileW(FileName);
341c2c66affSColin Finck ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
342c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\With Space", CustomPath);
343c2c66affSColin Finck Success = DeleteFileW(FileName);
344c2c66affSColin Finck ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
345c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\SomeProgram.exe", CustomPath);
346c2c66affSColin Finck Success = DeleteFileW(FileName);
347c2c66affSColin Finck ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
348c2c66affSColin Finck
349c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists\\ThisFileExists", CustomPath);
350c2c66affSColin Finck Success = DeleteFileW(FileName);
351c2c66affSColin Finck ok(Success, "DeleteFile failed (%lu), test might leave stale file\n", GetLastError());
352c2c66affSColin Finck swprintf(FileName, L"C:\\%ls\\ThisFolderExists", CustomPath);
353c2c66affSColin Finck Success = RemoveDirectoryW(FileName);
354c2c66affSColin Finck ok(Success, "RemoveDirectory failed (%lu), test might leave stale directory\n", GetLastError());
355c2c66affSColin Finck swprintf(FileName, L"C:\\%ls", CustomPath);
356c2c66affSColin Finck Success = RemoveDirectoryW(FileName);
357c2c66affSColin Finck ok(Success, "RemoveDirectory failed (%lu), test might leave stale directory\n", GetLastError());
358c2c66affSColin Finck }
359