~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/kernel32/tests/directory.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Unit test suite for directory functions.
  3  *
  4  * Copyright 2002 Dmitry Timoshkov
  5  *
  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.
 10  *
 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.
 15  *
 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
 19  */
 20 
 21 #include <stdarg.h>
 22 
 23 #include "wine/test.h"
 24 #include "windef.h"
 25 #include "winbase.h"
 26 #include "winerror.h"
 27 
 28 /* If you change something in these tests, please do the same
 29  * for GetSystemDirectory tests.
 30  */
 31 static void test_GetWindowsDirectoryA(void)
 32 {
 33     UINT len, len_with_null;
 34     char buf[MAX_PATH];
 35 
 36     len_with_null = GetWindowsDirectoryA(NULL, 0);
 37     ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
 38 
 39     lstrcpyA(buf, "foo");
 40     len_with_null = GetWindowsDirectoryA(buf, 1);
 41     ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
 42 
 43     lstrcpyA(buf, "foo");
 44     len = GetWindowsDirectoryA(buf, len_with_null - 1);
 45     ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
 46     ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
 47        len, len_with_null);
 48 
 49     lstrcpyA(buf, "foo");
 50     len = GetWindowsDirectoryA(buf, len_with_null);
 51     ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n");
 52     ok(len == strlen(buf), "returned length should be equal to the length of string\n");
 53     ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d\n",
 54        len, len_with_null-1);
 55 }
 56 
 57 static void test_GetWindowsDirectoryW(void)
 58 {
 59     UINT len, len_with_null;
 60     WCHAR buf[MAX_PATH];
 61     static const WCHAR fooW[] = {'f','o','o',0};
 62 
 63     len_with_null = GetWindowsDirectoryW(NULL, 0);
 64     if (len_with_null == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
 65     {
 66         win_skip("GetWindowsDirectoryW is not implemented\n");
 67         return;
 68     }
 69     ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
 70 
 71     lstrcpyW(buf, fooW);
 72     len = GetWindowsDirectoryW(buf, 1);
 73     ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
 74     ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
 75        len, len_with_null);
 76 
 77     lstrcpyW(buf, fooW);
 78     len = GetWindowsDirectoryW(buf, len_with_null - 1);
 79     ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
 80     ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
 81        len, len_with_null);
 82 
 83     lstrcpyW(buf, fooW);
 84     len = GetWindowsDirectoryW(buf, len_with_null);
 85     ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n");
 86     ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
 87     ok(len == len_with_null-1, "GetWindowsDirectoryW returned %d, expected %d\n",
 88        len, len_with_null-1);
 89 }
 90 
 91 
 92 /* If you change something in these tests, please do the same
 93  * for GetWindowsDirectory tests.
 94  */
 95 static void test_GetSystemDirectoryA(void)
 96 {
 97     UINT len, len_with_null;
 98     char buf[MAX_PATH];
 99 
100     len_with_null = GetSystemDirectoryA(NULL, 0);
101     ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
102 
103     lstrcpyA(buf, "foo");
104     len = GetSystemDirectoryA(buf, 1);
105     ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
106     ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n",
107        len, len_with_null);
108 
109     lstrcpyA(buf, "foo");
110     len = GetSystemDirectoryA(buf, len_with_null - 1);
111     ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
112     ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n",
113        len, len_with_null);
114 
115     lstrcpyA(buf, "foo");
116     len = GetSystemDirectoryA(buf, len_with_null);
117     ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n");
118     ok(len == strlen(buf), "returned length should be equal to the length of string\n");
119     ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n",
120        len, len_with_null-1);
121 }
122 
123 static void test_GetSystemDirectoryW(void)
124 {
125     UINT len, len_with_null;
126     WCHAR buf[MAX_PATH];
127     static const WCHAR fooW[] = {'f','o','o',0};
128 
129     len_with_null = GetSystemDirectoryW(NULL, 0);
130     if (len_with_null == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
131     {
132         win_skip("GetSystemDirectoryW is not available\n");
133         return;
134     }
135     ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
136 
137     lstrcpyW(buf, fooW);
138     len = GetSystemDirectoryW(buf, 1);
139     ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
140     ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n",
141        len, len_with_null);
142 
143     lstrcpyW(buf, fooW);
144     len = GetSystemDirectoryW(buf, len_with_null - 1);
145     ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
146     ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n",
147        len, len_with_null);
148 
149     lstrcpyW(buf, fooW);
150     len = GetSystemDirectoryW(buf, len_with_null);
151     ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n");
152     ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
153     ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n",
154        len, len_with_null-1);
155 }
156 
157 static void test_CreateDirectoryA(void)
158 {
159     char tmpdir[MAX_PATH];
160     BOOL ret;
161 
162     ret = CreateDirectoryA(NULL, NULL);
163     ok(ret == FALSE && (GetLastError() == ERROR_PATH_NOT_FOUND ||
164                         GetLastError() == ERROR_INVALID_PARAMETER),
165        "CreateDirectoryA(NULL): ret=%d err=%d\n", ret, GetLastError());
166 
167     ret = CreateDirectoryA("", NULL);
168     ok(ret == FALSE && (GetLastError() == ERROR_BAD_PATHNAME ||
169                         GetLastError() == ERROR_PATH_NOT_FOUND),
170        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
171 
172     ret = GetSystemDirectoryA(tmpdir, MAX_PATH);
173     ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
174 
175     ret = SetCurrentDirectoryA(tmpdir);
176     ok(ret == TRUE, "could not chdir to the System directory\n");
177 
178     ret = CreateDirectoryA(".", NULL);
179     ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
180        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
181 
182 
183     ret = CreateDirectoryA("..", NULL);
184     ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
185        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
186 
187     GetTempPathA(MAX_PATH, tmpdir);
188     tmpdir[3] = 0; /* truncate the path */
189     ret = CreateDirectoryA(tmpdir, NULL);
190     ok(ret == FALSE && (GetLastError() == ERROR_ALREADY_EXISTS ||
191                         GetLastError() == ERROR_ACCESS_DENIED),
192        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
193 
194     GetTempPathA(MAX_PATH, tmpdir);
195     lstrcatA(tmpdir, "Please Remove Me");
196     ret = CreateDirectoryA(tmpdir, NULL);
197     ok(ret == TRUE,       "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
198 
199     ret = CreateDirectoryA(tmpdir, NULL);
200     ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
201        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
202 
203     ret = RemoveDirectoryA(tmpdir);
204     ok(ret == TRUE,
205        "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
206 
207 
208     lstrcatA(tmpdir, "?");
209     ret = CreateDirectoryA(tmpdir, NULL);
210     ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
211                         GetLastError() == ERROR_PATH_NOT_FOUND),
212        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
213     RemoveDirectoryA(tmpdir);
214 
215     tmpdir[lstrlenA(tmpdir) - 1] = '*';
216     ret = CreateDirectoryA(tmpdir, NULL);
217     ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
218                         GetLastError() == ERROR_PATH_NOT_FOUND),
219        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
220     RemoveDirectoryA(tmpdir);
221 
222     GetTempPathA(MAX_PATH, tmpdir);
223     lstrcatA(tmpdir, "Please Remove Me/Please Remove Me");
224     ret = CreateDirectoryA(tmpdir, NULL);
225     ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, 
226        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
227     RemoveDirectoryA(tmpdir);
228 
229     /* Test behavior with a trailing dot.
230      * The directory should be created without the dot.
231      */
232     GetTempPathA(MAX_PATH, tmpdir);
233     lstrcatA(tmpdir, "Please Remove Me.");
234     ret = CreateDirectoryA(tmpdir, NULL);
235     ok(ret == TRUE,
236        "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
237 
238     lstrcatA(tmpdir, "/Please Remove Me");
239     ret = CreateDirectoryA(tmpdir, NULL);
240     ok(ret == TRUE,
241        "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
242     ret = RemoveDirectoryA(tmpdir);
243     ok(ret == TRUE,
244        "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
245 
246     GetTempPathA(MAX_PATH, tmpdir);
247     lstrcatA(tmpdir, "Please Remove Me");
248     ret = RemoveDirectoryA(tmpdir);
249     ok(ret == TRUE,
250        "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
251 
252     /* Test behavior with two trailing dots.
253      * The directory should be created without the trailing dots.
254      */
255     GetTempPathA(MAX_PATH, tmpdir);
256     lstrcatA(tmpdir, "Please Remove Me..");
257     ret = CreateDirectoryA(tmpdir, NULL);
258     ok(ret == TRUE,
259        "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
260 
261     lstrcatA(tmpdir, "/Please Remove Me");
262     ret = CreateDirectoryA(tmpdir, NULL);
263     ok(ret == TRUE || /* On Win98 */
264        (ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND), /* On NT! */
265        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
266     if (ret == TRUE)
267     {
268         ret = RemoveDirectoryA(tmpdir);
269         ok(ret == TRUE,
270            "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
271     }
272 
273     GetTempPathA(MAX_PATH, tmpdir);
274     lstrcatA(tmpdir, "Please Remove Me");
275     ret = RemoveDirectoryA(tmpdir);
276     ok(ret == TRUE,
277        "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
278 
279     /* Test behavior with a trailing space.
280      * The directory should be created without the trailing space.
281      */
282     GetTempPathA(MAX_PATH, tmpdir);
283     lstrcatA(tmpdir, "Please Remove Me ");
284     ret = CreateDirectoryA(tmpdir, NULL);
285     ok(ret == TRUE,
286        "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
287 
288     lstrcatA(tmpdir, "/Please Remove Me");
289     ret = CreateDirectoryA(tmpdir, NULL);
290     ok(ret == TRUE || /* On Win98 */
291        (ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND), /* On NT! */
292        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
293     if (ret == TRUE)
294     {
295         ret = RemoveDirectoryA(tmpdir);
296         ok(ret == TRUE,
297            "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
298     }
299 
300     GetTempPathA(MAX_PATH, tmpdir);
301     lstrcatA(tmpdir, "Please Remove Me");
302     ret = RemoveDirectoryA(tmpdir);
303     ok(ret == TRUE,
304        "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
305 
306     /* Test behavior with a trailing space.
307      * The directory should be created without the trailing spaces.
308      */
309     GetTempPathA(MAX_PATH, tmpdir);
310     lstrcatA(tmpdir, "Please Remove Me  ");
311     ret = CreateDirectoryA(tmpdir, NULL);
312     ok(ret == TRUE,
313        "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
314 
315     lstrcatA(tmpdir, "/Please Remove Me");
316     ret = CreateDirectoryA(tmpdir, NULL);
317     ok(ret == TRUE || /* On Win98 */
318        (ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND), /* On NT! */
319        "CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
320     if (ret == TRUE)
321     {
322         ret = RemoveDirectoryA(tmpdir);
323         ok(ret == TRUE,
324            "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
325     }
326 
327     GetTempPathA(MAX_PATH, tmpdir);
328     lstrcatA(tmpdir, "Please Remove Me");
329     ret = RemoveDirectoryA(tmpdir);
330     ok(ret == TRUE,
331        "RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
332 }
333 
334 static void test_CreateDirectoryW(void)
335 {
336     WCHAR tmpdir[MAX_PATH];
337     BOOL ret;
338     static const WCHAR empty_strW[] = { 0 };
339     static const WCHAR tmp_dir_name[] = {'P','l','e','a','s','e',' ','R','e','m','o','v','e',' ','M','e',0};
340     static const WCHAR dotW[] = {'.',0};
341     static const WCHAR slashW[] = {'/',0};
342     static const WCHAR dotdotW[] = {'.','.',0};
343     static const WCHAR questionW[] = {'?',0};
344 
345     ret = CreateDirectoryW(NULL, NULL);
346     if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
347     {
348         win_skip("CreateDirectoryW is not available\n");
349         return;
350     }
351     ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
352        "should not create NULL path ret %u err %u\n", ret, GetLastError());
353 
354     ret = CreateDirectoryW(empty_strW, NULL);
355     ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
356        "should not create empty path ret %u err %u\n", ret, GetLastError());
357 
358     ret = GetSystemDirectoryW(tmpdir, MAX_PATH);
359     ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
360 
361     ret = SetCurrentDirectoryW(tmpdir);
362     ok(ret == TRUE, "could not chdir to the System directory ret %u err %u\n", ret, GetLastError());
363 
364     ret = CreateDirectoryW(dotW, NULL);
365     ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
366        "should not create existing path ret %u err %u\n", ret, GetLastError());
367 
368     ret = CreateDirectoryW(dotdotW, NULL);
369     ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
370        "should not create existing path ret %u err %u\n", ret, GetLastError());
371 
372     GetTempPathW(MAX_PATH, tmpdir);
373     tmpdir[3] = 0; /* truncate the path */
374     ret = CreateDirectoryW(tmpdir, NULL);
375     ok(ret == FALSE && (GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_ALREADY_EXISTS),
376        "should deny access to the drive root ret %u err %u\n", ret, GetLastError());
377 
378     GetTempPathW(MAX_PATH, tmpdir);
379     lstrcatW(tmpdir, tmp_dir_name);
380     ret = CreateDirectoryW(tmpdir, NULL);
381     ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
382 
383     ret = CreateDirectoryW(tmpdir, NULL);
384     ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
385        "should not create existing path ret %u err %u\n", ret, GetLastError());
386 
387     ret = RemoveDirectoryW(tmpdir);
388     ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
389 
390     lstrcatW(tmpdir, questionW);
391     ret = CreateDirectoryW(tmpdir, NULL);
392     ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
393        "CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%d\n",
394        ret ? " True" : "False", GetLastError());
395     ret = RemoveDirectoryW(tmpdir);
396 
397     tmpdir[lstrlenW(tmpdir) - 1] = '*';
398     ret = CreateDirectoryW(tmpdir, NULL);
399     ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
400        "CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%d\n",
401        ret ? " True" : "False", GetLastError());
402     ret = RemoveDirectoryW(tmpdir);
403     
404     GetTempPathW(MAX_PATH, tmpdir);
405     lstrcatW(tmpdir, tmp_dir_name);
406     lstrcatW(tmpdir, slashW);
407     lstrcatW(tmpdir, tmp_dir_name);
408     ret = CreateDirectoryW(tmpdir, NULL);
409     ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
410       "CreateDirectoryW with multiple nonexistent directories in path should fail ret %u err %u\n",
411        ret, GetLastError());
412     ret = RemoveDirectoryW(tmpdir);
413 }
414 
415 static void test_RemoveDirectoryA(void)
416 {
417     char tmpdir[MAX_PATH];
418     BOOL ret;
419 
420     GetTempPathA(MAX_PATH, tmpdir);
421     lstrcatA(tmpdir, "Please Remove Me");
422     ret = CreateDirectoryA(tmpdir, NULL);
423     ok(ret == TRUE, "CreateDirectoryA should always succeed\n");
424 
425     ret = RemoveDirectoryA(tmpdir);
426     ok(ret == TRUE, "RemoveDirectoryA should always succeed\n");
427 
428     lstrcatA(tmpdir, "?");
429     ret = RemoveDirectoryA(tmpdir);
430     ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
431                         GetLastError() == ERROR_PATH_NOT_FOUND),
432        "RemoveDirectoryA with ? wildcard name should fail, ret=%s error=%d\n",
433        ret ? " True" : "False", GetLastError());
434 
435     tmpdir[lstrlenA(tmpdir) - 1] = '*';
436     ret = RemoveDirectoryA(tmpdir);
437     ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
438                         GetLastError() == ERROR_PATH_NOT_FOUND),
439        "RemoveDirectoryA with * wildcard name should fail, ret=%s error=%d\n",
440        ret ? " True" : "False", GetLastError());
441 }
442 
443 static void test_RemoveDirectoryW(void)
444 {
445     WCHAR tmpdir[MAX_PATH];
446     BOOL ret;
447     static const WCHAR tmp_dir_name[] = {'P','l','e','a','s','e',' ','R','e','m','o','v','e',' ','M','e',0};
448     static const WCHAR questionW[] = {'?',0};
449 
450     GetTempPathW(MAX_PATH, tmpdir);
451     lstrcatW(tmpdir, tmp_dir_name);
452     ret = CreateDirectoryW(tmpdir, NULL);
453     if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
454     {
455         win_skip("CreateDirectoryW is not available\n");
456         return;
457     }
458 
459     ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
460 
461     ret = RemoveDirectoryW(tmpdir);
462     ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
463 
464     lstrcatW(tmpdir, questionW);
465     ret = RemoveDirectoryW(tmpdir);
466     ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
467        "RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%d\n",
468        ret ? " True" : "False", GetLastError());
469 
470     tmpdir[lstrlenW(tmpdir) - 1] = '*';
471     ret = RemoveDirectoryW(tmpdir);
472     ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
473        "RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%d\n",
474        ret ? " True" : "False", GetLastError());
475 }
476 
477 static void test_SetCurrentDirectoryA(void)
478 {
479     SetLastError(0);
480     ok( !SetCurrentDirectoryA( "\\some_dummy_dir" ), "SetCurrentDirectoryA succeeded\n" );
481     ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %d\n", GetLastError() );
482     ok( !SetCurrentDirectoryA( "\\some_dummy\\subdir" ), "SetCurrentDirectoryA succeeded\n" );
483     ok( GetLastError() == ERROR_PATH_NOT_FOUND, "wrong error %d\n", GetLastError() );
484 }
485 
486 START_TEST(directory)
487 {
488     test_GetWindowsDirectoryA();
489     test_GetWindowsDirectoryW();
490 
491     test_GetSystemDirectoryA();
492     test_GetSystemDirectoryW();
493 
494     test_CreateDirectoryA();
495     test_CreateDirectoryW();
496 
497     test_RemoveDirectoryA();
498     test_RemoveDirectoryW();
499 
500     test_SetCurrentDirectoryA();
501 }
502 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.