ReactOS 0.4.16-dev-2204-g370eb8c
volume.c
Go to the documentation of this file.
1/*
2 * Unit test suite for volume functions
3 *
4 * Copyright 2006 Stefan Leichter
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 <stdio.h>
22#include "ntstatus.h"
23#define WIN32_NO_STATUS
24#include "windef.h"
25#include "winbase.h"
26#include "winioctl.h"
27#include "ntddstor.h"
28#include "winternl.h"
29#include "ddk/ntddcdvd.h"
30#include "ddk/mountmgr.h"
31#include "wine/test.h"
32
33#include <pshpack1.h>
35{
39};
40#include <poppack.h>
42
43#include <pshpack1.h>
45{
49};
50#include <poppack.h>
52
54static HANDLE (WINAPI *pFindFirstVolumeA)(LPSTR,DWORD);
55static BOOL (WINAPI *pFindNextVolumeA)(HANDLE,LPSTR,DWORD);
56static BOOL (WINAPI *pFindVolumeClose)(HANDLE);
57static UINT (WINAPI *pGetLogicalDriveStringsA)(UINT,LPSTR);
58static UINT (WINAPI *pGetLogicalDriveStringsW)(UINT,LPWSTR);
59static BOOL (WINAPI *pGetVolumePathNamesForVolumeNameA)(LPCSTR, LPSTR, DWORD, LPDWORD);
60static BOOL (WINAPI *pGetVolumePathNamesForVolumeNameW)(LPCWSTR, LPWSTR, DWORD, LPDWORD);
61static BOOL (WINAPI *pCreateSymbolicLinkA)(const char *, const char *, DWORD);
62static BOOL (WINAPI *pGetVolumeInformationByHandleW)(HANDLE, WCHAR *, DWORD, DWORD *, DWORD *, DWORD *, WCHAR *, DWORD);
63
64/* ############################### */
65
66static void test_query_dos_deviceA(void)
67{
68 char drivestr[] = "a:";
69 char *p, *buffer, buffer2[2000];
70 DWORD ret, ret2, buflen=32768;
71 BOOL found = FALSE;
72
73 /* callers must guess the buffer size */
74 SetLastError(0xdeadbeef);
77 "QueryDosDeviceA(no buffer): returned %lu, le=%lu\n", ret, GetLastError());
78
79 buffer = HeapAlloc( GetProcessHeap(), 0, buflen );
80 SetLastError(0xdeadbeef);
81 ret = QueryDosDeviceA( NULL, buffer, buflen );
83 "QueryDosDeviceA failed to return list, last error %lu\n", GetLastError());
84
86 p = buffer;
87 for (;;) {
88 if (!*p) break;
89 ret2 = QueryDosDeviceA( p, buffer2, sizeof(buffer2) );
90 /* Win10+ exposes the security device which requires extra privileges to be queried. So skip it */
91 ok(ret2 || broken( !strcmp( p, "MSSECFLTSYS" ) && GetLastError() == ERROR_ACCESS_DENIED ),
92 "QueryDosDeviceA failed to return current mapping for %s, last error %lu\n", p, GetLastError());
93 p += strlen(p) + 1;
94 if (ret <= (p-buffer)) break;
95 }
96 }
97
98 for (;drivestr[0] <= 'z'; drivestr[0]++) {
99 /* Older W2K fails with ERROR_INSUFFICIENT_BUFFER when buflen is > 32767 */
100 ret = QueryDosDeviceA( drivestr, buffer, buflen - 1);
102 "QueryDosDeviceA failed to return current mapping for %s, last error %lu\n", drivestr, GetLastError());
103 if(ret) {
104 for (p = buffer; *p; p++) *p = toupper(*p);
105 if (strstr(buffer, "HARDDISK") || strstr(buffer, "RAMDISK")) found = TRUE;
106 }
107 }
108 ok(found, "expected at least one devicename to contain HARDDISK or RAMDISK\n");
110}
111
112static void test_dos_devices(void)
113{
114 char buf[MAX_PATH], buf2[400];
115 char drivestr[3];
116 HANDLE file;
117 BOOL ret;
118#ifdef __REACTOS__
119 char root_path[MAX_PATH], buf3[MAX_PATH];
120
121 GetWindowsDirectoryA(root_path, sizeof(root_path));
122#endif
123
124 /* Find an unused drive letter */
125 drivestr[1] = ':';
126 drivestr[2] = 0;
127 for (drivestr[0] = 'a'; drivestr[0] <= 'z'; drivestr[0]++) {
128 ret = QueryDosDeviceA( drivestr, buf, sizeof(buf));
129 if (!ret) break;
130 }
131 if (drivestr[0] > 'z') {
132 skip("can't test creating a dos drive, none available\n");
133 return;
134 }
135
136#ifdef __REACTOS__
137 sprintf(buf3, "%s/", root_path);
138 for (char *p = buf3; *p; p++) {
139 if (*p == '\\') *p = '/'; // Replace backslashes with forward slashes
140 else if (p != buf3) *p = (char)tolower((unsigned char)*p); // Lowercase everything except the first character
141 }
142 ret = DefineDosDeviceA( 0, drivestr, buf3 );
143#else
144 ret = DefineDosDeviceA( 0, drivestr, "C:/windows/" );
145#endif
146 ok(ret, "failed to define drive %s, error %lu\n", drivestr, GetLastError());
147
148 ret = QueryDosDeviceA( drivestr, buf, sizeof(buf) );
149 ok(ret, "failed to query drive %s, error %lu\n", drivestr, GetLastError());
150#ifdef __REACTOS__
151 sprintf(buf3, "\\??\\%s\\", root_path);
152 for (char *p = buf3; *p; p++) {
153 if (p != (buf3 + 4)) *p = (char)tolower((unsigned char)*p); // Lowercase everything except "C:\"
154 }
155 ok(!strcmp(buf, buf3), "got path %s\n", debugstr_a(buf));
156#else
157 ok(!strcmp(buf, "\\??\\C:\\windows\\"), "got path %s\n", debugstr_a(buf));
158#endif
159
160 sprintf(buf, "%s/system32", drivestr);
163 todo_wine ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
164 CloseHandle( file );
165
166 /* but it's not a volume mount point */
167
168 sprintf(buf, "%s\\", drivestr);
169 ret = GetVolumeNameForVolumeMountPointA( buf, buf2, sizeof(buf2) );
170 ok(!ret, "expected failure\n");
172
174 ok(ret, "failed to remove drive %s, error %lu\n", drivestr, GetLastError());
175
176 ret = QueryDosDeviceA( drivestr, buf, sizeof(buf) );
177 ok(!ret, "expected failure\n");
178 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %lu\n", GetLastError());
179
180 sprintf(buf, "%s/system32", drivestr);
183 ok(file == INVALID_HANDLE_VALUE, "expected failure\n");
184 todo_wine ok(GetLastError() == ERROR_PATH_NOT_FOUND, "got error %lu\n", GetLastError());
185
186 /* try with DDD_RAW_TARGET_PATH */
187
188#ifdef __REACTOS__
189 ret = DefineDosDeviceA( DDD_RAW_TARGET_PATH, drivestr, buf3 );
190#else
191 ret = DefineDosDeviceA( DDD_RAW_TARGET_PATH, drivestr, "\\??\\C:\\windows\\" );
192#endif
193 ok(ret, "failed to define drive %s, error %lu\n", drivestr, GetLastError());
194
195 ret = QueryDosDeviceA( drivestr, buf, sizeof(buf) );
196 ok(ret, "failed to query drive %s, error %lu\n", drivestr, GetLastError());
197#ifdef __REACTOS__
198 ok(!strcmp(buf, buf3), "got path %s\n", debugstr_a(buf));
199#else
200 ok(!strcmp(buf, "\\??\\C:\\windows\\"), "got path %s\n", debugstr_a(buf));
201#endif
202
203 sprintf(buf, "%s/system32", drivestr);
206 todo_wine ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
207 CloseHandle( file );
208
209 sprintf(buf, "%s\\", drivestr);
210 ret = GetVolumeNameForVolumeMountPointA( buf, buf2, sizeof(buf2) );
211 ok(!ret, "expected failure\n");
213
215 ok(ret, "failed to remove drive %s, error %lu\n", drivestr, GetLastError());
216
217 ret = QueryDosDeviceA( drivestr, buf, sizeof(buf) );
218 ok(!ret, "expected failure\n");
219 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %lu\n", GetLastError());
220}
221
222static void test_FindFirstVolume(void)
223{
224 char volume[51];
226
227 /* not present before w2k */
228 if (!pFindFirstVolumeA) {
229 win_skip("FindFirstVolumeA not found\n");
230 return;
231 }
232
233 handle = pFindFirstVolumeA( volume, 0 );
234 ok( handle == INVALID_HANDLE_VALUE, "succeeded with short buffer\n" );
235 ok( GetLastError() == ERROR_MORE_DATA || /* XP */
237 "wrong error %lu\n", GetLastError() );
238 handle = pFindFirstVolumeA( volume, 49 );
239 ok( handle == INVALID_HANDLE_VALUE, "succeeded with short buffer\n" );
240 ok( GetLastError() == ERROR_FILENAME_EXCED_RANGE, "wrong error %lu\n", GetLastError() );
241 handle = pFindFirstVolumeA( volume, 51 );
242 ok( handle != INVALID_HANDLE_VALUE, "failed err %lu\n", GetLastError() );
244 {
245 do
246 {
247 ok( strlen(volume) == 49, "bad volume name %s\n", volume );
248 ok( !memcmp( volume, "\\\\?\\Volume{", 11 ), "bad volume name %s\n", volume );
249 ok( !memcmp( volume + 47, "}\\", 2 ), "bad volume name %s\n", volume );
250 } while (pFindNextVolumeA( handle, volume, MAX_PATH ));
251 ok( GetLastError() == ERROR_NO_MORE_FILES, "wrong error %lu\n", GetLastError() );
252 pFindVolumeClose( handle );
253 }
254}
255
257{
258 BOOL ret;
259 char volume[MAX_PATH], path[] = "c:\\";
260 DWORD len = sizeof(volume), reti;
261 char temp_path[MAX_PATH];
262
264 ok(reti != 0, "GetTempPathA error %ld\n", GetLastError());
265 ok(reti < MAX_PATH, "temp path should fit into MAX_PATH\n");
266
268 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
270 GetLastError() == ERROR_INVALID_PARAMETER, /* Vista */
271 "wrong error, last=%ld\n", GetLastError());
272
273 if (0) { /* these crash on XP */
275 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
276
278 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
279 }
280
282 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
283 ok(!strncmp( volume, "\\\\?\\Volume{", 11),
284 "GetVolumeNameForVolumeMountPointA failed to return valid string <%s>\n",
285 volume);
286
287 /* test with too small buffer */
290 "GetVolumeNameForVolumeMountPointA failed, wrong error returned, was %ld, should be ERROR_FILENAME_EXCED_RANGE\n",
291 GetLastError());
292
293 /* Try on an arbitrary directory */
294 /* On FAT filesystems it seems that GetLastError() is set to
295 ERROR_INVALID_FUNCTION. */
299 "GetVolumeNameForVolumeMountPointA failed on %s, last=%ld\n",
301
302 /* Try on a nonexistent dos drive */
303 path[2] = 0;
304 for (;path[0] <= 'z'; path[0]++) {
306 if(!ret) break;
307 }
308 if (path[0] <= 'z')
309 {
310 path[2] = '\\';
313 "GetVolumeNameForVolumeMountPointA failed on %s, last=%ld\n",
314 path, GetLastError());
315
316 /* Try without trailing \ and on a nonexistent dos drive */
317 path[2] = 0;
320 "GetVolumeNameForVolumeMountPointA failed on %s, last=%ld\n",
321 path, GetLastError());
322 }
323}
324
326{
327 BOOL ret;
328 WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0};
330
332 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
334 GetLastError() == ERROR_INVALID_PARAMETER, /* Vista */
335 "wrong error, last=%ld\n", GetLastError());
336
337 if (0) { /* these crash on XP */
339 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
340
342 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
343 }
344
346 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n");
347}
348
350{
351 UINT size, size2;
352 char *buf, *ptr;
353
354 ok( pGetLogicalDriveStringsA != NULL, "GetLogicalDriveStringsA not available\n");
355 if(!pGetLogicalDriveStringsA) {
356 return;
357 }
358
359 size = pGetLogicalDriveStringsA(0, NULL);
360 ok(size%4 == 1, "size = %d\n", size);
361
363
364 *buf = 0;
365 size2 = pGetLogicalDriveStringsA(2, buf);
366 ok(size2 == size, "size2 = %d\n", size2);
367 ok(!*buf, "buf changed\n");
368
369 size2 = pGetLogicalDriveStringsA(size, buf);
370 ok(size2 == size-1, "size2 = %d\n", size2);
371
372 for(ptr = buf; ptr < buf+size2; ptr += 4) {
373 ok(('A' <= *ptr && *ptr <= 'Z'), "device name '%c' is not uppercase\n", *ptr);
374 ok(ptr[1] == ':', "ptr[1] = %c, expected ':'\n", ptr[1]);
375 ok(ptr[2] == '\\', "ptr[2] = %c expected '\\'\n", ptr[2]);
376 ok(!ptr[3], "ptr[3] = %c expected nullbyte\n", ptr[3]);
377 }
378 ok(!*ptr, "buf[size2] is not nullbyte\n");
379
381}
382
384{
385 UINT size, size2;
386 WCHAR *buf, *ptr;
387
388 ok( pGetLogicalDriveStringsW != NULL, "GetLogicalDriveStringsW not available\n");
389 if(!pGetLogicalDriveStringsW) {
390 return;
391 }
392
393 SetLastError(0xdeadbeef);
394 size = pGetLogicalDriveStringsW(0, NULL);
396 win_skip("GetLogicalDriveStringsW not implemented\n");
397 return;
398 }
399 ok(size%4 == 1, "size = %d\n", size);
400
401 buf = HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR));
402
403 *buf = 0;
404 size2 = pGetLogicalDriveStringsW(2, buf);
405 ok(size2 == size, "size2 = %d\n", size2);
406 ok(!*buf, "buf changed\n");
407
408 size2 = pGetLogicalDriveStringsW(size, buf);
409 ok(size2 == size-1, "size2 = %d\n", size2);
410
411 for(ptr = buf; ptr < buf+size2; ptr += 4) {
412 ok('A' <= *ptr && *ptr <= 'Z', "device name '%c' is not uppercase\n", *ptr);
413 ok(ptr[1] == ':', "ptr[1] = %c, expected ':'\n", ptr[1]);
414 ok(ptr[2] == '\\', "ptr[2] = %c expected '\\'\n", ptr[2]);
415 ok(!ptr[3], "ptr[3] = %c expected nullbyte\n", ptr[3]);
416 }
417 ok(!*ptr, "buf[size2] is not nullbyte\n");
418
420}
421
423{
424 BOOL ret;
425 UINT result;
426 char Root_Colon[]="C:";
427 char Root_Slash[]="C:\\";
428 char Root_UNC[]="\\\\?\\C:\\";
429 char volume[MAX_PATH+1];
430 DWORD vol_name_size=MAX_PATH+1, vol_serial_num=-1, max_comp_len=0, fs_flags=0, fs_name_len=MAX_PATH+1;
431 char vol_name_buf[MAX_PATH+1], fs_name_buf[MAX_PATH+1];
432 char windowsdir[MAX_PATH+10];
433 char currentdir[MAX_PATH+1];
434
435 /* get windows drive letter and update strings for testing */
436 result = GetWindowsDirectoryA(windowsdir, sizeof(windowsdir));
437 ok(result < sizeof(windowsdir), "windowsdir is abnormally long!\n");
438 ok(result != 0, "GetWindowsDirectory: error %ld\n", GetLastError());
439 Root_Colon[0] = windowsdir[0];
440 Root_Slash[0] = windowsdir[0];
441 Root_UNC[4] = windowsdir[0];
442
443 result = GetCurrentDirectoryA(MAX_PATH, currentdir);
444 ok(result, "GetCurrentDirectory: error %ld\n", GetLastError());
445 /* Note that GetCurrentDir yields no trailing slash for subdirs */
446
447 /* check for NO error on no trailing \ when current dir is root dir */
448 ret = SetCurrentDirectoryA(Root_Slash);
449 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
450 ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
451 NULL, NULL, fs_name_buf, fs_name_len);
452 ok(ret, "GetVolumeInformationA root failed, last error %lu\n", GetLastError());
453
454 /* check for error on no trailing \ when current dir is subdir (windows) of queried drive */
455 ret = SetCurrentDirectoryA(windowsdir);
456 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
457 SetLastError(0xdeadbeef);
458 ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
459 NULL, NULL, fs_name_buf, fs_name_len);
461 "GetVolumeInformationA did%s fail, last error %lu\n", ret ? " not":"", GetLastError());
462
463 /* reset current directory */
464 ret = SetCurrentDirectoryA(currentdir);
465 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
466
467 if (toupper(currentdir[0]) == toupper(windowsdir[0])) {
468 skip("Please re-run from another device than %c:\n", windowsdir[0]);
469 /* FIXME: Use GetLogicalDrives to find another device to avoid this skip. */
470 } else {
471 char Root_Env[]="=C:"; /* where MS maintains the per volume directory */
472 Root_Env[1] = windowsdir[0];
473
474 /* C:\windows becomes the current directory on drive C: */
475 /* Note that paths to subdirs are stored without trailing slash, like what GetCurrentDir yields. */
476 ret = SetEnvironmentVariableA(Root_Env, windowsdir);
477 ok(ret, "SetEnvironmentVariable %s failed\n", Root_Env);
478
479 ret = SetCurrentDirectoryA(windowsdir);
480 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
481 ret = SetCurrentDirectoryA(currentdir);
482 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
483
484 /* windows dir is current on the root drive, call fails */
485 SetLastError(0xdeadbeef);
486 ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
487 NULL, NULL, fs_name_buf, fs_name_len);
489 "GetVolumeInformationA did%s fail, last error %lu\n", ret ? " not":"", GetLastError());
490
491 /* Try normal drive letter with trailing \ */
492 ret = GetVolumeInformationA(Root_Slash, vol_name_buf, vol_name_size, NULL,
493 NULL, NULL, fs_name_buf, fs_name_len);
494 ok(ret, "GetVolumeInformationA with \\ failed, last error %lu\n", GetLastError());
495
496 ret = SetCurrentDirectoryA(Root_Slash);
497 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
498 ret = SetCurrentDirectoryA(currentdir);
499 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
500
501 /* windows dir is STILL CURRENT on root drive; the call fails as before, */
502 /* proving that SetCurrentDir did not remember the other drive's directory */
503 SetLastError(0xdeadbeef);
504 ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
505 NULL, NULL, fs_name_buf, fs_name_len);
507 "GetVolumeInformationA did%s fail, last error %lu\n", ret ? " not":"", GetLastError());
508
509 /* Now C:\ becomes the current directory on drive C: */
510 ret = SetEnvironmentVariableA(Root_Env, Root_Slash); /* set =C:=C:\ */
511 ok(ret, "SetEnvironmentVariable %s failed\n", Root_Env);
512
513 /* \ is current on root drive, call succeeds */
514 ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
515 NULL, NULL, fs_name_buf, fs_name_len);
516 ok(ret, "GetVolumeInformationA failed, last error %lu\n", GetLastError());
517
518 /* again, SetCurrentDirectory on another drive does not matter */
519 ret = SetCurrentDirectoryA(Root_Slash);
520 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
521 ret = SetCurrentDirectoryA(currentdir);
522 ok(ret, "SetCurrentDirectory: error %ld\n", GetLastError());
523
524 /* \ is current on root drive, call succeeds */
525 ret = GetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
526 NULL, NULL, fs_name_buf, fs_name_len);
527 ok(ret, "GetVolumeInformationA failed, last error %lu\n", GetLastError());
528 }
529
530 /* try null root directory to return "root of the current directory" */
531 ret = GetVolumeInformationA(NULL, vol_name_buf, vol_name_size, NULL,
532 NULL, NULL, fs_name_buf, fs_name_len);
533 ok(ret, "GetVolumeInformationA failed on null root dir, last error %lu\n", GetLastError());
534
535 /* Try normal drive letter with trailing \ */
536 ret = GetVolumeInformationA(Root_Slash, vol_name_buf, vol_name_size,
537 &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
538 ok(ret, "GetVolumeInformationA failed, root=%s, last error=%lu\n", Root_Slash, GetLastError());
539
540 /* try again with drive letter and the "disable parsing" prefix */
541 SetLastError(0xdeadbeef);
542 ret = GetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
543 &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
544 ok(ret, "GetVolumeInformationA did%s fail, root=%s, last error=%lu\n", ret ? " not":"", Root_UNC, GetLastError());
545
546 /* try again with device name space */
547 Root_UNC[2] = '.';
548 SetLastError(0xdeadbeef);
549 ret = GetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
550 &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
551 ok(ret, "GetVolumeInformationA did%s fail, root=%s, last error=%lu\n", ret ? " not":"", Root_UNC, GetLastError());
552
553 /* try again with a directory off the root - should generate error */
554 if (windowsdir[strlen(windowsdir)-1] != '\\') strcat(windowsdir, "\\");
555 SetLastError(0xdeadbeef);
556 ret = GetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
557 &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
559 "GetVolumeInformationA did%s fail, root=%s, last error=%lu\n", ret ? " not":"", windowsdir, GetLastError());
560 /* A subdir with trailing \ yields DIR_NOT_ROOT instead of INVALID_NAME */
561 if (windowsdir[strlen(windowsdir)-1] == '\\') windowsdir[strlen(windowsdir)-1] = 0;
562 SetLastError(0xdeadbeef);
563 ret = GetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
564 &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
566 "GetVolumeInformationA did%s fail, root=%s, last error=%lu\n", ret ? " not":"", windowsdir, GetLastError());
567
568 /* get the unique volume name for the windows drive */
570 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
571
572 /* try again with unique volume name */
573 ret = GetVolumeInformationA(volume, vol_name_buf, vol_name_size,
574 &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
575 ok(ret, "GetVolumeInformationA failed, root=%s, last error=%lu\n", volume, GetLastError());
576}
577
578/* Test to check that unique volume name from windows dir mount point */
579/* matches at least one of the unique volume names returned from the */
580/* FindFirstVolumeA/FindNextVolumeA list. */
581static void test_enum_vols(void)
582{
583 DWORD ret;
585 char Volume_1[MAX_PATH] = {0};
586 char Volume_2[MAX_PATH] = {0};
587 char path[] = "c:\\";
588 BOOL found = FALSE;
589 char windowsdir[MAX_PATH];
590
591 /*get windows drive letter and update strings for testing */
592 ret = GetWindowsDirectoryA( windowsdir, sizeof(windowsdir) );
593 ok(ret < sizeof(windowsdir), "windowsdir is abnormally long!\n");
594 ok(ret != 0, "GetWindowsDirectory: error %ld\n", GetLastError());
595 path[0] = windowsdir[0];
596
597 /* get the unique volume name for the windows drive */
599 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
600 ok(strlen(Volume_1) == 49, "GetVolumeNameForVolumeMountPointA returned wrong length name %s\n", Volume_1);
601
602 /* get first unique volume name of list */
603 hFind = pFindFirstVolumeA( Volume_2, MAX_PATH );
604 ok(hFind != INVALID_HANDLE_VALUE, "FindFirstVolume failed, err=%lu\n",
605 GetLastError());
606
607 do
608 {
609 /* validate correct length of unique volume name */
610 ok(strlen(Volume_2) == 49, "Find[First/Next]Volume returned wrong length name %s\n", Volume_1);
611 if (memcmp(Volume_1, Volume_2, 49) == 0)
612 {
613 found = TRUE;
614 break;
615 }
616 } while (pFindNextVolumeA( hFind, Volume_2, MAX_PATH ));
617 ok(found, "volume name %s not found by Find[First/Next]Volume\n", Volume_1);
618 pFindVolumeClose( hFind );
619}
620
621static void test_disk_extents(void)
622{
623 BOOL ret;
624 DWORD size;
626 static DWORD data[16];
627
630 {
631 win_skip("can't open c: drive %lu\n", GetLastError());
632 return;
633 }
634 size = 0;
636 sizeof(data), &data, sizeof(data), &size, NULL );
638 {
639 win_skip("IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS not supported\n");
641 return;
642 }
643 ok(ret, "DeviceIoControl failed %lu\n", GetLastError());
644 ok(size == 32, "expected 32, got %lu\n", size);
646}
647
649{
653 DEVICE_SEEK_PENALTY_DESCRIPTOR seek_pen = {0};
655 DWORD error;
656 DWORD size;
657 BOOL ret;
658
660 0, 0);
662 {
663 win_skip("can't open \\\\.\\PhysicalDrive0 %#lx\n", GetLastError());
664 return;
665 }
666
667 query.PropertyId = StorageDeviceProperty;
668 query.QueryType = PropertyStandardQuery;
669
670 SetLastError(0xdeadbeef);
672 NULL);
674 ok(ret, "expect ret %#x, got %#x\n", TRUE, ret);
675 ok(error == 0xdeadbeef, "expect err %#x, got err %#lx\n", 0xdeadbeef, error);
676 ok(size == sizeof(header), "got size %ld\n", size);
677 ok(header.Version == sizeof(descriptor), "got header.Version %ld\n", header.Version);
678 ok(header.Size >= sizeof(descriptor), "got header.Size %ld\n", header.Size);
679
680 SetLastError(0xdeadbeef);
682 &size, NULL);
684 ok(ret, "expect ret %#x, got %#x\n", TRUE, ret);
685 ok(error == 0xdeadbeef, "expect err %#x, got err %#lx\n", 0xdeadbeef, error);
686 ok(size == sizeof(descriptor), "got size %ld\n", size);
687 ok(descriptor.Version == sizeof(descriptor), "got descriptor.Version %ld\n", descriptor.Version);
688 ok(descriptor.Size >= sizeof(descriptor), "got descriptor.Size %ld\n", descriptor.Size);
689
690
692 query.QueryType = PropertyStandardQuery;
693 SetLastError(0xdeadbeef);
695 NULL);
698 {
699 win_skip( "StorageDeviceSeekPenaltyProperty is not supported.\n" ); /* Win7 */
700 }
701 else
702 {
703#ifdef __REACTOS__
705#endif
706 ok(ret, "expect ret %#x, got %#x\n", TRUE, ret);
707 ok(error == 0xdeadbeef, "expect err %#x, got err %#lx\n", 0xdeadbeef, error);
708 ok(size == sizeof(header), "got size %ld\n", size);
709 ok(header.Version == sizeof(seek_pen), "got header.Version %ld\n", header.Version);
710 ok(header.Size == sizeof(seek_pen), "got header.Size %ld\n", header.Size);
711
712 memset(&seek_pen, 0xcc, sizeof(seek_pen));
713 ret = DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof(query), &seek_pen, sizeof(seek_pen),
714 &size, NULL);
716 ok(ret || (error == ERROR_INVALID_FUNCTION /* Win8 VMs */ || (error == ERROR_GEN_FAILURE /* VMs */)),
717 "got ret %d, error %#lx\n", ret, error);
718 if (ret)
719 {
720 ok(size == sizeof(seek_pen), "got size %ld\n", size);
721 ok(seek_pen.Version == sizeof(seek_pen), "got %ld\n", seek_pen.Version);
722 ok(seek_pen.Size == sizeof(seek_pen), "got %ld\n", seek_pen.Size);
723 ok(seek_pen.IncursSeekPenalty == TRUE || seek_pen.IncursSeekPenalty == FALSE, "got %d.\n", seek_pen.IncursSeekPenalty);
724 }
725#ifdef __REACTOS__
726 }
727#endif
728 }
729
731}
732
733static void test_GetVolumePathNameA(void)
734{
735 char volume_path[MAX_PATH], cwd[MAX_PATH], expect_path[MAX_PATH];
736 struct {
737 const char *file_name;
738 const char *path_name;
740 DWORD error;
741 DWORD broken_error;
742 } test_paths[] = {
743 { /* test 0: NULL parameters, 0 output length */
744 NULL, NULL, 0,
745 ERROR_INVALID_PARAMETER, 0xdeadbeef /* winxp */
746 },
747 { /* empty input, NULL output, 0 output length */
748 "", NULL, 0,
749 ERROR_INVALID_PARAMETER, 0xdeadbeef /* winxp */
750 },
751 { /* valid input, NULL output, 0 output length */
752 "C:\\", NULL, 0,
754 },
755 { /* valid input, valid output, 0 output length */
756 "C:\\", "C:\\", 0,
758 },
759 { /* valid input, valid output, 1 output length */
760 "C:\\", "C:\\", 1,
762 },
763 { /* test 5: valid input, valid output, valid output length */
764 "C:\\", "C:\\", sizeof(volume_path),
766 },
767 { /* lowercase input, uppercase output, valid output length */
768 "c:\\", "C:\\", sizeof(volume_path),
770 },
771 { /* really bogus input, valid output, 1 output length */
772 "\\\\$$$", "C:\\", 1,
774 },
775 { /* a reasonable DOS path that is guaranteed to exist */
776 "C:\\windows\\system32", "C:\\", sizeof(volume_path),
778 },
779 { /* a reasonable DOS path that shouldn't exist */
780 "C:\\windows\\system32\\AnInvalidFolder", "C:\\", sizeof(volume_path),
782 },
783 { /* test 10: a reasonable NT-converted DOS path that shouldn't exist */
784 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:\\", sizeof(volume_path),
786 },
787 { /* an unreasonable NT-converted DOS path */
788 "\\\\?\\InvalidDrive:\\AnInvalidFolder", "\\\\?\\InvalidDrive:\\" /* win2k, winxp */,
789 sizeof(volume_path),
791 },
792 { /* an unreasonable NT volume path */
793 "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\AnInvalidFolder",
794 "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\" /* win2k, winxp */,
795 sizeof(volume_path),
797 },
798 { /* an unreasonable NT-ish path */
799 "\\\\ReallyBogus\\InvalidDrive:\\AnInvalidFolder",
800 "\\\\ReallyBogus\\InvalidDrive:\\" /* win2k, winxp */, sizeof(volume_path),
802 },
803 {
804 "M::", "C:\\", 4,
806 },
807 { /* test 15 */
808 "C:", "C:", 2,
810 },
811 {
812 "C:", "C:", 3,
814 },
815 {
816 "C:\\", "C:", 2,
818 },
819 {
820 "C:\\", "C:", 3,
822 },
823 {
824 "C::", "C:", 2,
826 },
827 { /* test 20 */
828 "C::", "C:", 3,
830 },
831 {
832 "C:\\windows\\system32\\AnInvalidFolder", "C:", 3,
834 },
835 {
836 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 3,
838 },
839 {
840 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 6,
842 },
843 {
844 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 7,
846 },
847 { /* test 25 */
848 "\\\\?\\c:\\AnInvalidFolder", "\\\\?\\c:", 7,
850 },
851 {
852 "C:/", "C:\\", 4,
854 },
855 {
856 "M:/", "", 4,
858 },
859 {
860 "?:ABC:DEF:\\AnInvalidFolder", "?:\\" /* win2k, winxp */, sizeof(volume_path),
862 },
863 {
864 "s:omefile", "S:\\" /* win2k, winxp */, sizeof(volume_path),
866 },
867 { /* test 30: a reasonable forward slash path that is guaranteed to exist */
868 "C:/windows/system32", "C:\\", sizeof(volume_path),
870 },
871 };
872
873 static const char *relative_tests[] =
874 {
875 "InvalidDrive:\\AnInvalidFolder",
876 "relative/path",
877 "somefile:def",
878 };
879
880 static const char *global_prefix_tests[] =
881 {
882 "\\??\\CdRom0",
883 "\\??\\ReallyBogus",
884 "\\??\\C:\\NonExistent",
885 "\\??\\M:\\NonExistent",
886 };
887
889 DWORD error;
890 UINT i;
891
892#ifdef __REACTOS__
893 char sysroot[MAX_PATH];
894 char patched[MAX_PATH];
895
896 /* Get the real system root and lowercase everything other than "C:\""*/
898 for (char *p = sysroot; *p; p++)
899 if (p != sysroot) *p = (char)tolower((unsigned char)*p);;
900
901 /* Patch test 8: "C:\\windows\\system32" */
902 sprintf(patched, "%s\\system32", sysroot);
903 test_paths[8].file_name = _strdup(patched);
904
905 /* Patch test 9: "C:\\windows\\system32\\AnInvalidFolder" */
906 sprintf(patched, "%s\\system32\\AnInvalidFolder", sysroot);
907 test_paths[9].file_name = _strdup(patched);
908
909 /* Patch test 30: "C:/windows/system32" (forward slashes) */
910 sprintf(patched, "%s/system32", sysroot);
911 for (char *p = patched; *p; p++)
912 if (*p == '\\') *p = '/';
913 test_paths[30].file_name = _strdup(patched);
914#endif
915
916 for (i=0; i<ARRAY_SIZE(test_paths); i++)
917 {
918 BOOL broken_ret = test_paths[i].broken_error == NO_ERROR;
919 char *output = (test_paths[i].path_name != NULL ? volume_path : NULL);
920 BOOL expected_ret = test_paths[i].error == NO_ERROR;
921
922 volume_path[0] = 0;
923 if (test_paths[i].path_len < sizeof(volume_path))
924 volume_path[ test_paths[i].path_len ] = 0x11;
925
926 SetLastError( 0xdeadbeef );
927 ret = GetVolumePathNameA( test_paths[i].file_name, output, test_paths[i].path_len );
929 ok(ret == expected_ret || broken(ret == broken_ret),
930 "GetVolumePathName test %d %s unexpectedly.\n",
931 i, test_paths[i].error == NO_ERROR ? "failed" : "succeeded");
932
933 if (ret)
934 {
935 ok(!strcmp( volume_path, test_paths[i].path_name )
936 || broken(!strcasecmp( volume_path, test_paths[i].path_name )), /* XP */
937 "GetVolumePathName test %d unexpectedly returned path %s (expected %s).\n",
938 i, volume_path, test_paths[i].path_name);
939 }
940 else
941 {
942 /* On success Windows always returns ERROR_MORE_DATA, so only worry about failure */
943 success = (error == test_paths[i].error || broken(error == test_paths[i].broken_error));
944 ok(success, "GetVolumePathName test %d unexpectedly returned error 0x%lx (expected 0x%lx).\n",
945 i, error, test_paths[i].error);
946 }
947
948 if (test_paths[i].path_len < sizeof(volume_path))
949 ok(volume_path[ test_paths[i].path_len ] == 0x11,
950 "GetVolumePathName test %d corrupted byte after end of buffer.\n", i);
951 }
952
953 ret = GetCurrentDirectoryA( sizeof(cwd), cwd );
954 ok(ret, "Failed to obtain the current working directory, error %lu.\n", GetLastError());
955 ret = GetVolumePathNameA( cwd, expect_path, sizeof(expect_path) );
956 ok(ret, "Failed to obtain the current volume path, error %lu.\n", GetLastError());
957
958 for (i = 0; i < ARRAY_SIZE(relative_tests); i++)
959 {
960 ret = GetVolumePathNameA( relative_tests[i], volume_path, sizeof(volume_path) );
961 ok(ret, "GetVolumePathName(%s) failed unexpectedly, error %lu.\n",
962 debugstr_a( relative_tests[i] ), GetLastError());
963 ok(!strcmp( volume_path, expect_path ), "%s: expected %s, got %s.\n",
964 debugstr_a( relative_tests[i] ), debugstr_a( expect_path ), debugstr_a( volume_path ));
965 }
966
967 cwd[3] = 0;
968 for (i = 0; i < ARRAY_SIZE(global_prefix_tests); i++)
969 {
970 ret = GetVolumePathNameA( global_prefix_tests[i], volume_path, sizeof(volume_path) );
971 ok(ret, "GetVolumePathName(%s) failed unexpectedly, error %lu.\n",
972 debugstr_a( global_prefix_tests[i] ), GetLastError());
973 ok(!strcmp( volume_path, cwd ), "%s: expected %s, got %s.\n",
974 debugstr_a( global_prefix_tests[i] ), debugstr_a( cwd ), debugstr_a( volume_path ));
975 }
976
977 ret = GetVolumePathNameA( "C:.", expect_path, sizeof(expect_path) );
978 ok(ret, "Failed to obtain the volume path, error %lu.\n", GetLastError());
979
980 SetLastError( 0xdeadbeef );
981 ret = GetVolumePathNameA( "C::", volume_path, 1 );
982 ok(!ret, "Expected failure.\n");
983 ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE, "Got error %lu.\n", GetLastError());
984
985 ret = GetVolumePathNameA( "C::", volume_path, sizeof(volume_path) );
986 ok(ret, "Failed to obtain the volume path, error %lu.\n", GetLastError());
987 ok(!strcmp(volume_path, expect_path), "Expected %s, got %s.\n",
988 debugstr_a( expect_path ), debugstr_a( volume_path ));
989
990 ret = GetVolumePathNameA( "C:ABC:DEF:\\AnInvalidFolder", volume_path, sizeof(volume_path) );
991 ok(ret, "Failed to obtain the volume path, error %lu.\n", GetLastError());
992 ok(!strcmp(volume_path, expect_path), "Expected %s, got %s.\n",
993 debugstr_a( expect_path ), debugstr_a( volume_path ));
994#ifdef __REACTOS__
995 /* Free patched strings */
996 free((void*)test_paths[8].file_name);
997 free((void*)test_paths[9].file_name);
998 free((void*)test_paths[30].file_name);
999#endif
1000}
1001
1003{
1004 WCHAR volume_path[MAX_PATH];
1005 BOOL ret;
1006
1007 volume_path[0] = 0;
1008 volume_path[1] = 0x11;
1009 ret = GetVolumePathNameW( L"C:\\", volume_path, 1 );
1010 ok(!ret, "GetVolumePathNameW test succeeded unexpectedly.\n");
1011 ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE, "GetVolumePathNameW unexpectedly returned error 0x%lx (expected 0x%x).\n",
1013 ok(volume_path[1] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n");
1014
1015 volume_path[0] = 0;
1016 volume_path[2] = 0x11;
1017 ret = GetVolumePathNameW( L"C:\\", volume_path, 2 );
1018 ok(!ret, "GetVolumePathNameW test succeeded unexpectedly.\n");
1019 ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE, "GetVolumePathNameW unexpectedly returned error 0x%lx (expected 0x%x).\n",
1021 ok(volume_path[2] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n");
1022
1023 volume_path[0] = 0;
1024 volume_path[3] = 0x11;
1025 ret = GetVolumePathNameW( L"C:\\", volume_path, 3 );
1026 ok(ret || broken(!ret) /* win2k */, "GetVolumePathNameW test failed unexpectedly.\n");
1027 ok(!memcmp(volume_path, L"C:\\", 3) || broken(!volume_path[0]) /* XP */,
1028 "Got wrong path %s.\n", debugstr_w(volume_path));
1029 ok(volume_path[3] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n");
1030
1031 volume_path[0] = 0;
1032 volume_path[4] = 0x11;
1033 ret = GetVolumePathNameW( L"C:\\", volume_path, 4 );
1034 ok(ret, "GetVolumePathNameW test failed unexpectedly.\n");
1035 ok(!wcscmp(volume_path, L"C:\\"), "Got wrong path %s.\n", debugstr_w(volume_path));
1036 ok(volume_path[4] == 0x11, "GetVolumePathW corrupted byte after end of buffer.\n");
1037}
1038
1040{
1041 BOOL ret;
1043 DWORD len, error;
1044
1045 if (!pGetVolumePathNamesForVolumeNameA)
1046 {
1047 win_skip("required functions not found\n");
1048 return;
1049 }
1050
1051 ret = GetVolumeNameForVolumeMountPointA( "c:\\", volume, sizeof(volume) );
1052 ok(ret, "failed to get volume name %lu\n", GetLastError());
1053 trace("c:\\ -> %s\n", volume);
1054
1055 SetLastError( 0xdeadbeef );
1056 ret = pGetVolumePathNamesForVolumeNameA( NULL, NULL, 0, NULL );
1057 error = GetLastError();
1058 ok(!ret, "expected failure\n");
1059 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1060
1061 SetLastError( 0xdeadbeef );
1062 ret = pGetVolumePathNamesForVolumeNameA( "", NULL, 0, NULL );
1063 error = GetLastError();
1064 ok(!ret, "expected failure\n");
1065 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1066
1067 SetLastError( 0xdeadbeef );
1068 ret = pGetVolumePathNamesForVolumeNameA( volume, NULL, 0, NULL );
1069 error = GetLastError();
1070 ok(!ret, "expected failure\n");
1071 ok(error == ERROR_MORE_DATA, "expected ERROR_MORE_DATA got %lu\n", error);
1072
1073 SetLastError( 0xdeadbeef );
1074 ret = pGetVolumePathNamesForVolumeNameA( volume, buffer, 0, NULL );
1075 error = GetLastError();
1076 ok(!ret, "expected failure\n");
1077 ok(error == ERROR_MORE_DATA, "expected ERROR_MORE_DATA got %lu\n", error);
1078
1079 memset( buffer, 0xff, sizeof(buffer) );
1080 ret = pGetVolumePathNamesForVolumeNameA( volume, buffer, sizeof(buffer), NULL );
1081 ok(ret, "failed to get path names %lu\n", GetLastError());
1082 ok(!strcmp( "C:\\", buffer ), "expected \"\\C:\" got \"%s\"\n", buffer);
1083 ok(!buffer[4], "expected double null-terminated buffer\n");
1084
1085 len = 0;
1086 SetLastError( 0xdeadbeef );
1087 ret = pGetVolumePathNamesForVolumeNameA( NULL, NULL, 0, &len );
1088 error = GetLastError();
1089 ok(!ret, "expected failure\n");
1090 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1091
1092 len = 0;
1093 SetLastError( 0xdeadbeef );
1094 ret = pGetVolumePathNamesForVolumeNameA( NULL, NULL, sizeof(buffer), &len );
1095 error = GetLastError();
1096 ok(!ret, "expected failure\n");
1097 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1098
1099 len = 0;
1100 SetLastError( 0xdeadbeef );
1101 ret = pGetVolumePathNamesForVolumeNameA( NULL, buffer, sizeof(buffer), &len );
1102 error = GetLastError();
1103 ok(!ret, "expected failure\n");
1104 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1105
1106 len = 0;
1107 SetLastError( 0xdeadbeef );
1108 ret = pGetVolumePathNamesForVolumeNameA( NULL, buffer, sizeof(buffer), &len );
1109 error = GetLastError();
1110 ok(!ret, "expected failure\n");
1111 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1112
1113 len = 0;
1114 memset( buffer, 0xff, sizeof(buffer) );
1115 ret = pGetVolumePathNamesForVolumeNameA( volume, buffer, sizeof(buffer), &len );
1116 ok(ret, "failed to get path names %lu\n", GetLastError());
1117 ok(len == 5 || broken(len == 2), "expected 5 got %lu\n", len);
1118 ok(!strcmp( "C:\\", buffer ), "expected \"\\C:\" got \"%s\"\n", buffer);
1119 ok(!buffer[4], "expected double null-terminated buffer\n");
1120}
1121
1123{
1124 static const WCHAR empty[] = {0};
1125 static const WCHAR drive_c[] = {'c',':','\\',0};
1126 static const WCHAR volume_null[] = {'\\','\\','?','\\','V','o','l','u','m','e',
1127 '{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0',
1128 '-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}','\\',0};
1129 BOOL ret;
1131 DWORD len, error;
1132
1133 if (!pGetVolumePathNamesForVolumeNameW)
1134 {
1135 win_skip("required functions not found\n");
1136 return;
1137 }
1138
1140 ok(ret, "failed to get volume name %lu\n", GetLastError());
1141
1142 SetLastError( 0xdeadbeef );
1143 ret = pGetVolumePathNamesForVolumeNameW( empty, NULL, 0, NULL );
1144 error = GetLastError();
1145 ok(!ret, "expected failure\n");
1146 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1147
1148 SetLastError( 0xdeadbeef );
1149 ret = pGetVolumePathNamesForVolumeNameW( volume, NULL, 0, NULL );
1150 error = GetLastError();
1151 ok(!ret, "expected failure\n");
1152 ok(error == ERROR_MORE_DATA, "expected ERROR_MORE_DATA got %lu\n", error);
1153
1154 SetLastError( 0xdeadbeef );
1155 ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, 0, NULL );
1156 error = GetLastError();
1157 ok(!ret, "expected failure\n");
1158 ok(error == ERROR_MORE_DATA, "expected ERROR_MORE_DATA got %lu\n", error);
1159
1160 if (0) { /* crash */
1161 ret = pGetVolumePathNamesForVolumeNameW( volume, NULL, ARRAY_SIZE(buffer), NULL );
1162 ok(ret, "failed to get path names %lu\n", GetLastError());
1163 }
1164
1165 ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, ARRAY_SIZE(buffer), NULL );
1166 ok(ret, "failed to get path names %lu\n", GetLastError());
1167
1168 len = 0;
1169 memset( buffer, 0xff, sizeof(buffer) );
1170 ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, ARRAY_SIZE(buffer), &len );
1171 ok(ret, "failed to get path names %lu\n", GetLastError());
1172 ok(len == 5, "expected 5 got %lu\n", len);
1173 ok(!buffer[4], "expected double null-terminated buffer\n");
1174
1175 len = 0;
1176 volume[1] = '?';
1177 volume[lstrlenW( volume ) - 1] = 0;
1178 SetLastError( 0xdeadbeef );
1179 ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, ARRAY_SIZE(buffer), &len );
1180 error = GetLastError();
1181 ok(!ret, "expected failure\n");
1182 ok(error == ERROR_INVALID_NAME, "expected ERROR_INVALID_NAME got %lu\n", error);
1183
1184 len = 0;
1185 volume[0] = '\\';
1186 volume[1] = 0;
1187 SetLastError( 0xdeadbeef );
1188 ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, ARRAY_SIZE(buffer), &len );
1189 error = GetLastError();
1190 ok(!ret, "expected failure\n");
1191 todo_wine ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %lu\n", error);
1192
1193 len = 0;
1194 lstrcpyW( volume, volume_null );
1195 SetLastError( 0xdeadbeef );
1196 ret = pGetVolumePathNamesForVolumeNameW( volume, buffer, ARRAY_SIZE(buffer), &len );
1197 error = GetLastError();
1198 ok(!ret, "expected failure\n");
1199 ok(error == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND got %lu\n", error);
1200}
1201
1203{
1204 int i;
1205 DWORD nbBytes;
1206 BOOL ret;
1207 DVD_READ_STRUCTURE dvdReadStructure;
1208 DVD_LAYER_DESCRIPTOR dvdLayerDescriptor;
1209 struct COMPLETE_DVD_LAYER_DESCRIPTOR completeDvdLayerDescriptor;
1210 DVD_COPYRIGHT_DESCRIPTOR dvdCopyrightDescriptor;
1211 struct COMPLETE_DVD_MANUFACTURER_DESCRIPTOR completeDvdManufacturerDescriptor;
1212
1213 dvdReadStructure.BlockByteOffset.QuadPart = 0;
1214 dvdReadStructure.SessionId = 0;
1215 dvdReadStructure.LayerNumber = 0;
1216
1217
1218 /* DvdPhysicalDescriptor */
1219 dvdReadStructure.Format = 0;
1220
1221 SetLastError(0xdeadbeef);
1222
1223 /* Test whether this ioctl is supported */
1225 &completeDvdLayerDescriptor, sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR), &nbBytes, NULL);
1226
1227 if(!ret)
1228 {
1229 skip("IOCTL_DVD_READ_STRUCTURE not supported: %lu\n", GetLastError());
1230 return;
1231 }
1232
1233 /* Confirm there is always a header before the actual data */
1234 ok( completeDvdLayerDescriptor.Header.Length == 0x0802, "Length is 0x%04x instead of 0x0802\n", completeDvdLayerDescriptor.Header.Length);
1235 ok( completeDvdLayerDescriptor.Header.Reserved[0] == 0, "Reserved[0] is %x instead of 0\n", completeDvdLayerDescriptor.Header.Reserved[0]);
1236 ok( completeDvdLayerDescriptor.Header.Reserved[1] == 0, "Reserved[1] is %x instead of 0\n", completeDvdLayerDescriptor.Header.Reserved[1]);
1237
1238 /* TODO: Also check completeDvdLayerDescriptor.Descriptor content (via IOCTL_SCSI_PASS_THROUGH_DIRECT ?) */
1239
1240 /* Insufficient output buffer */
1241 for(i=0; i<sizeof(DVD_DESCRIPTOR_HEADER); i++)
1242 {
1243 SetLastError(0xdeadbeef);
1244
1246 &completeDvdLayerDescriptor, i, &nbBytes, NULL);
1247 ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,"IOCTL_DVD_READ_STRUCTURE should fail with small buffer\n");
1248 }
1249
1250 SetLastError(0xdeadbeef);
1251
1252 /* On newer version, an output buffer of sizeof(DVD_READ_STRUCTURE) size fails.
1253 I think this is to force developers to realize that there is a header before the actual content */
1255 &dvdLayerDescriptor, sizeof(DVD_LAYER_DESCRIPTOR), &nbBytes, NULL);
1256 ok( (!ret && GetLastError() == ERROR_INVALID_PARAMETER) || broken(ret) /* < Win7 */,
1257 "IOCTL_DVD_READ_STRUCTURE should have failed\n");
1258
1259 SetLastError(0xdeadbeef);
1260
1262 &completeDvdLayerDescriptor, sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR), &nbBytes, NULL);
1264 "IOCTL_DVD_READ_STRUCTURE should have failed\n");
1265
1266 /* Test wrong input parameters */
1267 for(i=0; i<sizeof(DVD_READ_STRUCTURE); i++)
1268 {
1269 SetLastError(0xdeadbeef);
1270
1271 ret = DeviceIoControl(handle, IOCTL_DVD_READ_STRUCTURE, &dvdReadStructure, i,
1272 &completeDvdLayerDescriptor, sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR), &nbBytes, NULL);
1274 "IOCTL_DVD_READ_STRUCTURE should have failed\n");
1275 }
1276
1277
1278 /* DvdCopyrightDescriptor */
1279 dvdReadStructure.Format = 1;
1280
1281 SetLastError(0xdeadbeef);
1282
1283 /* Strangely, with NULL lpOutBuffer, last error is insufficient buffer, not invalid parameter as we could expect */
1285 NULL, sizeof(DVD_COPYRIGHT_DESCRIPTOR), &nbBytes, NULL);
1286 ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "IOCTL_DVD_READ_STRUCTURE should have failed %d %lu\n", ret, GetLastError());
1287
1288 for(i=0; i<sizeof(DVD_COPYRIGHT_DESCRIPTOR); i++)
1289 {
1290 SetLastError(0xdeadbeef);
1291
1293 &dvdCopyrightDescriptor, i, &nbBytes, NULL);
1294 ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "IOCTL_DVD_READ_STRUCTURE should have failed %d %lu\n", ret, GetLastError());
1295 }
1296
1297
1298 /* DvdManufacturerDescriptor */
1299 dvdReadStructure.Format = 4;
1300
1301 SetLastError(0xdeadbeef);
1302
1304 &completeDvdManufacturerDescriptor, sizeof(DVD_MANUFACTURER_DESCRIPTOR), &nbBytes, NULL);
1306 "IOCTL_DVD_READ_STRUCTURE (DvdManufacturerDescriptor) failed, last error = %lu\n", GetLastError());
1307 if(!ret)
1308 return;
1309
1310 /* Confirm there is always a header before the actual data */
1311 ok( completeDvdManufacturerDescriptor.Header.Length == 0x0802, "Length is 0x%04x instead of 0x0802\n", completeDvdManufacturerDescriptor.Header.Length);
1312 ok( completeDvdManufacturerDescriptor.Header.Reserved[0] == 0, "Reserved[0] is %x instead of 0\n", completeDvdManufacturerDescriptor.Header.Reserved[0]);
1313 ok( completeDvdManufacturerDescriptor.Header.Reserved[1] == 0, "Reserved[1] is %x instead of 0\n", completeDvdManufacturerDescriptor.Header.Reserved[1]);
1314
1315 SetLastError(0xdeadbeef);
1316
1317 /* Basic parameter check */
1319 NULL, sizeof(DVD_MANUFACTURER_DESCRIPTOR), &nbBytes, NULL);
1320 ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "IOCTL_DVD_READ_STRUCTURE should have failed %d %lu\n", ret, GetLastError());
1321}
1322
1323static void test_cdrom_ioctl(void)
1324{
1325 char drive_letter, drive_path[] = "A:\\", drive_full_path[] = "\\\\.\\A:";
1326 DWORD bitmask;
1327 HANDLE handle;
1328
1329 bitmask = GetLogicalDrives();
1330 if(!bitmask)
1331 {
1332 trace("GetLogicalDrives failed : %lu\n", GetLastError());
1333 return;
1334 }
1335
1336 for(drive_letter='A'; drive_letter<='Z'; drive_letter++)
1337 {
1338 if(!(bitmask & (1 << (drive_letter-'A') )))
1339 continue;
1340
1341 drive_path[0] = drive_letter;
1342 if(GetDriveTypeA(drive_path) != DRIVE_CDROM)
1343 {
1344 trace("Skipping %c:, not a CDROM drive.\n", drive_letter);
1345 continue;
1346 }
1347
1348 trace("Testing with %c:\n", drive_letter);
1349
1350 drive_full_path[4] = drive_letter;
1353 {
1354 trace("Failed to open the device : %lu\n", GetLastError());
1355 continue;
1356 }
1357
1358 /* Add your tests here */
1360
1362 }
1363
1364}
1365
1366static void test_mounted_folder(void)
1367{
1368 char name_buffer[200], path[MAX_PATH], volume_name[100], *p;
1370 FILE_ATTRIBUTE_TAG_INFO info;
1372 BOOL ret, got_path;
1374 HANDLE file;
1375 DWORD size;
1376#ifdef __REACTOS__
1377 int i = 0;
1378 char sysroot[MAX_PATH] = {0}, buf[MAX_PATH] = {0};
1379 WCHAR buf2[MAX_PATH] = {0};
1380
1382 for (char *p = sysroot; *p; p++) {
1383 // Lowercase everything except "C:\"
1384 if (p != sysroot) *p = (char)tolower((unsigned char)*p);
1385 }
1386#endif
1387
1390 ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
1391
1393 ok(!status, "got status %#lx\n", status);
1394 ok(!(info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
1395 && (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY), "got attributes %#lx\n", info.FileAttributes);
1396 ok(!info.ReparseTag, "got reparse tag %#lx\n", info.ReparseTag);
1397
1398 CloseHandle( file );
1399
1402 ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
1403
1405 ok(!status, "got status %#lx\n", status);
1406 ok(!(info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
1407 && (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY), "got attributes %#lx\n", info.FileAttributes);
1408 ok(!info.ReparseTag, "got reparse tag %#lx\n", info.ReparseTag);
1409
1410 CloseHandle( file );
1411
1412 ret = GetFileAttributesA( "C:\\" );
1413 ok(!(ret & FILE_ATTRIBUTE_REPARSE_POINT) && (ret & FILE_ATTRIBUTE_DIRECTORY), "got attributes %#x\n", ret);
1414
1415 ret = CreateDirectoryA("C:\\winetest_mnt", NULL);
1417 {
1418 skip("Not enough permissions to create a folder in the C: drive.\n");
1419 return;
1420 }
1421 ok(ret, "got error %lu\n", GetLastError());
1422
1424 ok(ret, "got error %lu\n", GetLastError());
1425
1426 ret = SetVolumeMountPointA( "C:\\winetest_mnt\\", volume_name );
1427 if (!ret)
1428 {
1429 skip("Not enough permissions to create a mounted folder.\n");
1430 RemoveDirectoryA( "C:\\winetest_mnt" );
1431 return;
1432 }
1433 todo_wine ok(ret, "got error %lu\n", GetLastError());
1434
1435 file = CreateFileA( "C:\\winetest_mnt", 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
1437 ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
1438
1440 ok(!status, "got status %#lx\n", status);
1441 ok((info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
1442 && (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY), "got attributes %#lx\n", info.FileAttributes);
1443 ok(info.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT, "got reparse tag %#lx\n", info.ReparseTag);
1444
1445 status = NtQueryInformationFile( file, &io, name, sizeof(name_buffer), FileNameInformation );
1446 ok(!status, "got status %#lx\n", status);
1447 ok(name->FileNameLength == wcslen(L"\\winetest_mnt") * sizeof(WCHAR), "got length %lu\n", name->FileNameLength);
1448 ok(!wcsnicmp(name->FileName, L"\\winetest_mnt", wcslen(L"\\winetest_mnt")), "got name %s\n",
1449 debugstr_wn(name->FileName, name->FileNameLength / sizeof(WCHAR)));
1450
1451 CloseHandle( file );
1452
1453 file = CreateFileA( "C:\\winetest_mnt", 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
1455 ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
1456
1458 ok(!status, "got status %#lx\n", status);
1459 ok(!(info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
1460 && (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY), "got attributes %#lx\n", info.FileAttributes);
1461 ok(!info.ReparseTag, "got reparse tag %#lx\n", info.ReparseTag);
1462
1463 status = NtQueryInformationFile( file, &io, name, sizeof(name_buffer), FileNameInformation );
1464 ok(!status, "got status %#lx\n", status);
1465 ok(name->FileNameLength == wcslen(L"\\") * sizeof(WCHAR), "got length %lu\n", name->FileNameLength);
1466 ok(!wcsnicmp(name->FileName, L"\\", wcslen(L"\\")), "got name %s\n",
1467 debugstr_wn(name->FileName, name->FileNameLength / sizeof(WCHAR)));
1468
1469 CloseHandle( file );
1470
1471 ret = GetFileAttributesA( "C:\\winetest_mnt" );
1472 ok(ret != INVALID_FILE_ATTRIBUTES, "got error %lu\n", GetLastError());
1473 ok((ret & FILE_ATTRIBUTE_REPARSE_POINT) && (ret & FILE_ATTRIBUTE_DIRECTORY), "got attributes %#x\n", ret);
1474
1475#ifdef __REACTOS__
1476 sprintf(buf, "C:\\winetest_mnt\\%s", sysroot + 3);
1479#else
1480 file = CreateFileA( "C:\\winetest_mnt\\windows", 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
1482#endif
1483 ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
1484
1485 status = NtQueryInformationFile( file, &io, name, sizeof(name_buffer), FileNameInformation );
1486 ok(!status, "got status %#lx\n", status);
1487#ifdef __REACTOS__
1488 /* Copy \windows (or \reactos) to buf2. */
1489 while ((buf2[i] = (WCHAR)(unsigned char)sysroot[i+2]) != 0) i++;
1490 ok(name->FileNameLength == wcslen(buf2) * sizeof(WCHAR), "got length %lu\n", name->FileNameLength);
1491 ok(!wcsnicmp(name->FileName, buf2, wcslen(buf2)), "got name %s\n",
1492 debugstr_wn(name->FileName, name->FileNameLength / sizeof(WCHAR)));
1493#else
1494 ok(name->FileNameLength == wcslen(L"\\windows") * sizeof(WCHAR), "got length %lu\n", name->FileNameLength);
1495 ok(!wcsnicmp(name->FileName, L"\\windows", wcslen(L"\\windows")), "got name %s\n",
1496 debugstr_wn(name->FileName, name->FileNameLength / sizeof(WCHAR)));
1497#endif
1498
1499 CloseHandle( file );
1500
1501 ret = GetVolumePathNameA( "C:\\winetest_mnt", path, sizeof(path) );
1502 ok(ret, "got error %lu\n", GetLastError());
1503 ok(!strcmp(path, "C:\\winetest_mnt\\"), "got %s\n", debugstr_a(path));
1504 SetLastError(0xdeadbeef);
1505 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_mnt", path, sizeof(path) );
1506 ok(!ret, "expected failure\n");
1507 ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %lu\n", GetLastError());
1508 SetLastError(0xdeadbeef);
1509 ret = GetVolumeInformationA( "C:\\winetest_mnt", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1510 ok(!ret, "expected failure\n");
1511 ok(GetLastError() == ERROR_INVALID_NAME, "wrong error %lu\n", GetLastError());
1512
1513 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_mnt\\", path, sizeof(path) );
1514 ok(ret, "got error %lu\n", GetLastError());
1515 ok(!strcmp(path, volume_name), "expected %s, got %s\n", debugstr_a(volume_name), debugstr_a(path));
1516 ret = GetVolumeInformationA( "C:\\winetest_mnt\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1517 ok(ret, "got error %lu\n", GetLastError());
1518
1519#ifdef __REACTOS__
1520 ret = GetVolumePathNameA( buf, path, sizeof(path) );
1521#else
1522 ret = GetVolumePathNameA( "C:\\winetest_mnt\\windows", path, sizeof(path) );
1523#endif
1524 ok(ret, "got error %lu\n", GetLastError());
1525 ok(!strcmp(path, "C:\\winetest_mnt\\"), "got %s\n", debugstr_a(path));
1526 SetLastError(0xdeadbeef);
1527#ifdef __REACTOS__
1528 strcat(buf, "\\");
1530#else
1531 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_mnt\\windows\\", path, sizeof(path) );
1532#endif
1533 ok(!ret, "expected failure\n");
1534 ok(GetLastError() == ERROR_NOT_A_REPARSE_POINT, "wrong error %lu\n", GetLastError());
1535 SetLastError(0xdeadbeef);
1536#ifdef __REACTOS__
1538#else
1539 ret = GetVolumeInformationA( "C:\\winetest_mnt\\windows\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1540#endif
1541 ok(!ret, "expected failure\n");
1542 ok(GetLastError() == ERROR_DIR_NOT_ROOT, "wrong error %lu\n", GetLastError());
1543
1544 ret = GetVolumePathNameA( "C:\\winetest_mnt\\nonexistent\\", path, sizeof(path) );
1545 ok(ret, "got error %lu\n", GetLastError());
1546 ok(!strcmp(path, "C:\\winetest_mnt\\"), "got %s\n", debugstr_a(path));
1547 SetLastError(0xdeadbeef);
1548 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_mnt\\nonexistent\\", path, sizeof(path) );
1549 ok(!ret, "expected failure\n");
1550 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
1551 SetLastError(0xdeadbeef);
1552 ret = GetVolumeInformationA( "C:\\winetest_mnt\\nonexistent\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1553 ok(!ret, "expected failure\n");
1554 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
1555
1556 ret = GetVolumePathNameA( "C:\\winetest_mnt\\winetest_mnt", path, sizeof(path) );
1557 ok(ret, "got error %lu\n", GetLastError());
1558 ok(!strcmp(path, "C:\\winetest_mnt\\winetest_mnt\\"), "got %s\n", debugstr_a(path));
1559 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_mnt\\winetest_mnt\\", path, sizeof(path) );
1560 ok(ret, "got error %lu\n", GetLastError());
1561 ok(!strcmp(path, volume_name), "expected %s, got %s\n", debugstr_a(volume_name), debugstr_a(path));
1562 ret = GetVolumeInformationA( "C:\\winetest_mnt\\winetest_mnt\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1563 ok(ret, "got error %lu\n", GetLastError());
1564
1565 ret = GetVolumePathNameA( "C:/winetest_mnt/../winetest_mnt/.", path, sizeof(path) );
1566 ok(ret, "got error %lu\n", GetLastError());
1567 ok(!strcmp(path, "C:\\winetest_mnt\\"), "got %s\n", debugstr_a(path));
1568 ret = GetVolumeNameForVolumeMountPointA( "C:/winetest_mnt/../winetest_mnt/.\\", path, sizeof(path) );
1569 ok(ret, "got error %lu\n", GetLastError());
1570 ok(!strcmp(path, volume_name), "expected %s, got %s\n", debugstr_a(volume_name), debugstr_a(path));
1571 ret = GetVolumeInformationA( "C:/winetest_mnt/../winetest_mnt/.\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1572 ok(ret, "got error %lu\n", GetLastError());
1573
1575 ok(ret, "got error %lu\n", GetLastError());
1576 got_path = FALSE;
1577 for (p = path; *p; p += strlen(p) + 1)
1578 {
1579 if (!strcmp( p, "C:\\winetest_mnt\\" ))
1580 got_path = TRUE;
1581 ok(strcmp( p, "C:\\winetest_mnt\\winetest_mnt\\" ), "GetVolumePathNamesForVolumeName() should not recurse\n");
1582 }
1583 ok(got_path, "mount point was not enumerated\n");
1584
1585 /* test interaction with symbolic links */
1586
1587 if (pCreateSymbolicLinkA)
1588 {
1589 ret = pCreateSymbolicLinkA( "C:\\winetest_link", "C:\\winetest_mnt\\", SYMBOLIC_LINK_FLAG_DIRECTORY );
1590 ok(ret, "got error %lu\n", GetLastError());
1591
1592 ret = GetVolumePathNameA( "C:\\winetest_link\\", path, sizeof(path) );
1593 ok(ret, "got error %lu\n", GetLastError());
1594 ok(!strcmp(path, "C:\\"), "got %s\n", path);
1595 SetLastError(0xdeadbeef);
1596 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_link\\", path, sizeof(path) );
1597 ok(!ret, "expected failure\n");
1599 || broken(GetLastError() == ERROR_SUCCESS) /* 2008 */, "wrong error %lu\n", GetLastError());
1600 ret = GetVolumeInformationA( "C:\\winetest_link\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1601 ok(ret, "got error %lu\n", GetLastError());
1602
1603#ifdef __REACTOS__
1604 sprintf(buf, "C:\\winetest_link\\%s", sysroot + 3);
1605 ret = GetVolumePathNameA( buf, path, sizeof(path) );
1606#else
1607 ret = GetVolumePathNameA( "C:\\winetest_link\\windows\\", path, sizeof(path) );
1608#endif
1609 ok(ret, "got error %lu\n", GetLastError());
1610 ok(!strcmp(path, "C:\\"), "got %s\n", path);
1611 SetLastError(0xdeadbeef);
1612#ifdef __REACTOS__
1614#else
1615 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_link\\windows\\", path, sizeof(path) );
1616#endif
1617 ok(!ret, "expected failure\n");
1618 ok(GetLastError() == ERROR_NOT_A_REPARSE_POINT, "wrong error %lu\n", GetLastError());
1619 SetLastError(0xdeadbeef);
1620#ifdef __REACTOS__
1622#else
1623 ret = GetVolumeInformationA( "C:\\winetest_link\\windows\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1624#endif
1625 ok(!ret, "expected failure\n");
1626 ok(GetLastError() == ERROR_DIR_NOT_ROOT, "wrong error %lu\n", GetLastError());
1627
1628 ret = GetVolumePathNameA( "C:\\winetest_link\\winetest_mnt", path, sizeof(path) );
1629 ok(ret, "got error %lu\n", GetLastError());
1630 ok(!strcmp(path, "C:\\winetest_link\\winetest_mnt\\"), "got %s\n", debugstr_a(path));
1631 ret = GetVolumeNameForVolumeMountPointA( "C:\\winetest_link\\winetest_mnt\\", path, sizeof(path) );
1632 ok(ret, "got error %lu\n", GetLastError());
1633 ok(!strcmp(path, volume_name), "expected %s, got %s\n", debugstr_a(volume_name), debugstr_a(path));
1634 ret = GetVolumeInformationA( "C:\\winetest_link\\winetest_mnt\\", NULL, 0, NULL, NULL, NULL, NULL, 0 );
1635 ok(ret, "got error %lu\n", GetLastError());
1636
1637 /* The following test makes it clear that when we encounter a symlink
1638 * while resolving, we resolve *every* junction in the path, i.e. both
1639 * mount points and symlinks. */
1640#ifdef __REACTOS__
1641 sprintf(buf, "C:\\winetest_link\\winetest_mnt\\winetest_link\\%s\\", sysroot + 3);
1642 ret = GetVolumePathNameA( buf, path, sizeof(path) );
1643#else
1644 ret = GetVolumePathNameA( "C:\\winetest_link\\winetest_mnt\\winetest_link\\windows\\", path, sizeof(path) );
1645#endif
1646 ok(ret, "got error %lu\n", GetLastError());
1647 ok(!strcmp(path, "C:\\") || !strcmp(path, "C:\\winetest_link\\winetest_mnt\\") /* 2008 */,
1648 "got %s\n", debugstr_a(path));
1649
1650#ifdef __REACTOS__
1652#else
1653 file = CreateFileA( "C:\\winetest_link\\winetest_mnt\\winetest_link\\windows\\", 0,
1655#endif
1656 ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
1657
1658 status = NtQueryInformationFile( file, &io, name, sizeof(name_buffer), FileNameInformation );
1659 ok(!status, "got status %#lx\n", status);
1660#ifdef __REACTOS__
1661 ok(name->FileNameLength == wcslen(buf2) * sizeof(WCHAR), "got length %lu\n", name->FileNameLength);
1662 ok(!wcsnicmp(name->FileName, buf2, wcslen(buf2)), "got name %s\n",
1663 debugstr_wn(name->FileName, name->FileNameLength / sizeof(WCHAR)));
1664#else
1665 ok(name->FileNameLength == wcslen(L"\\windows") * sizeof(WCHAR), "got length %lu\n", name->FileNameLength);
1666 ok(!wcsnicmp(name->FileName, L"\\windows", wcslen(L"\\windows")), "got name %s\n",
1667 debugstr_wn(name->FileName, name->FileNameLength / sizeof(WCHAR)));
1668#endif
1669
1670 CloseHandle( file );
1671
1672 ret = RemoveDirectoryA( "C:\\winetest_link\\" );
1673 ok(ret, "got error %lu\n", GetLastError());
1674
1675 /* The following cannot be automatically tested:
1676 *
1677 * Suppose C: and D: are mount points of different volumes. If C:/a is
1678 * symlinked to D:/b, GetVolumePathName("C:\\a") will return "D:\\" if
1679 * "a" is a directory, but "C:\\" if "a" is a file.
1680 * Moreover, if D: is mounted at C:/mnt, and C:/a is symlinked to
1681 * C:/mnt, GetVolumePathName("C:\\mnt\\b") will still return "D:\\". */
1682 }
1683
1684 ret = DeleteVolumeMountPointA( "C:\\winetest_mnt\\" );
1685 ok(ret, "got error %lu\n", GetLastError());
1686 ret = RemoveDirectoryA( "C:\\winetest_mnt" );
1687 ok(ret, "got error %lu\n", GetLastError());
1688}
1689
1691{
1692 char DECLSPEC_ALIGN(8) buffer[50];
1693 FILE_FS_ATTRIBUTE_INFORMATION *attr_info = (void *)buffer;
1695 DWORD serial, filename_len, flags;
1696 WCHAR label[20], fsname[20];
1697 char volume[MAX_PATH+1];
1699 HANDLE file;
1701 BOOL ret;
1702#ifdef __REACTOS__
1703 char sysroot[MAX_PATH];
1704
1706 for (char *p = sysroot; *p; p++) {
1707 if (*p == '\\') *p = '/'; // Use forward slashes
1708 else if (p != sysroot) *p = (char)tolower((unsigned char)*p); // Lowercase everything except "C:\"
1709 }
1710#endif
1711
1712#if defined(__REACTOS__) && DLL_EXPORT_VERSION >= 0x600
1713 /* FIXME: GetVolumeInformationByHandleW is a STUB on ReactOS! */
1714 if (is_reactos() || !pGetVolumeInformationByHandleW)
1715#else
1716 if (!pGetVolumeInformationByHandleW)
1717#endif
1718 {
1719 win_skip("GetVolumeInformationByHandleW is not present.\n");
1720 return;
1721 }
1722
1723#ifdef __REACTOS__
1726#else
1727 file = CreateFileA( "C:/windows", 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
1729#endif
1730 ok(file != INVALID_HANDLE_VALUE, "failed to open file, error %lu\n", GetLastError());
1731
1732 SetLastError(0xdeadbeef);
1733 ret = pGetVolumeInformationByHandleW( INVALID_HANDLE_VALUE, label, ARRAY_SIZE(label), &serial,
1734 &filename_len, &flags, fsname, ARRAY_SIZE(fsname) );
1735 ok(!ret, "expected failure\n");
1736 ok(GetLastError() == ERROR_INVALID_HANDLE, "got error %lu\n", GetLastError());
1737
1738 ret = pGetVolumeInformationByHandleW( file, NULL, 0, NULL, NULL, NULL, NULL, 0 );
1739 ok(ret, "got error %lu\n", GetLastError());
1740
1741 ret = pGetVolumeInformationByHandleW( file, label, ARRAY_SIZE(label), &serial,
1742 &filename_len, &flags, fsname, ARRAY_SIZE(fsname) );
1743 ok(ret, "got error %lu\n", GetLastError());
1744
1745 memset(buffer, 0, sizeof(buffer));
1747 ok(!status, "got status %#lx\n", status);
1748 ok(flags == attr_info->FileSystemAttributes, "expected flags %#lx, got %#lx\n",
1749 attr_info->FileSystemAttributes, flags);
1750 ok(filename_len == attr_info->MaximumComponentNameLength, "expected filename_len %lu, got %lu\n",
1751 attr_info->MaximumComponentNameLength, filename_len);
1752 ok(!wcscmp( fsname, attr_info->FileSystemName ), "expected fsname %s, got %s\n",
1753 debugstr_w( attr_info->FileSystemName ), debugstr_w( fsname ));
1754 ok(wcslen( fsname ) == attr_info->FileSystemNameLength / sizeof(WCHAR), "got %Iu\n", wcslen( fsname ));
1755
1756 SetLastError(0xdeadbeef);
1757 ret = pGetVolumeInformationByHandleW( file, NULL, 0, NULL, &filename_len, &flags, fsname, 2 );
1758 ok(!ret, "expected failure\n");
1759 ok(GetLastError() == ERROR_BAD_LENGTH, "got error %lu\n", GetLastError());
1760
1761 memset(buffer, 0, sizeof(buffer));
1763 ok(!status, "got status %#lx\n", status);
1764 ok(serial == volume_info->VolumeSerialNumber, "expected serial %08lx, got %08lx\n",
1765 volume_info->VolumeSerialNumber, serial);
1766 ok(!wcscmp( label, volume_info->VolumeLabel ), "expected label %s, got %s\n",
1767 debugstr_w( volume_info->VolumeLabel ), debugstr_w( label ));
1768 ok(wcslen( label ) == volume_info->VolumeLabelLength / sizeof(WCHAR), "got %Iu\n", wcslen( label ));
1769
1770 CloseHandle( file );
1771
1772 /* get the unique volume name for the windows drive */
1774 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
1775
1776 /* try again with unique volume name */
1777
1780 ok(file != INVALID_HANDLE_VALUE, "failed to open file, error %lu\n", GetLastError());
1781
1782 ret = pGetVolumeInformationByHandleW( file, label, ARRAY_SIZE(label), &serial,
1783 &filename_len, &flags, fsname, ARRAY_SIZE(fsname) );
1784 ok(ret, "got error %lu\n", GetLastError());
1785
1786 memset(buffer, 0, sizeof(buffer));
1788 ok(!status, "got status %#lx\n", status);
1789 ok(serial == volume_info->VolumeSerialNumber, "expected serial %08lx, got %08lx\n",
1790 volume_info->VolumeSerialNumber, serial);
1791 ok(!wcscmp( label, volume_info->VolumeLabel ), "expected label %s, got %s\n",
1792 debugstr_w( volume_info->VolumeLabel ), debugstr_w( label ));
1793 ok(wcslen( label ) == volume_info->VolumeLabelLength / sizeof(WCHAR), "got %Iu\n", wcslen( label ));
1794
1795 memset(buffer, 0, sizeof(buffer));
1797 ok(!status, "got status %#lx\n", status);
1798 ok(flags == attr_info->FileSystemAttributes, "expected flags %#lx, got %#lx\n",
1799 attr_info->FileSystemAttributes, flags);
1800 ok(filename_len == attr_info->MaximumComponentNameLength, "expected filename_len %lu, got %lu\n",
1801 attr_info->MaximumComponentNameLength, filename_len);
1802 ok(!wcscmp( fsname, attr_info->FileSystemName ), "expected fsname %s, got %s\n",
1803 debugstr_w( attr_info->FileSystemName ), debugstr_w( fsname ));
1804 ok(wcslen( fsname ) == attr_info->FileSystemNameLength / sizeof(WCHAR), "got %Iu\n", wcslen( fsname ));
1805
1806 CloseHandle( file );
1807}
1808
1810{
1811 char input_buffer[64];
1812 MOUNTMGR_MOUNT_POINTS *output;
1816 HANDLE file;
1817
1818 output = malloc(1024);
1819
1821 ok(file != INVALID_HANDLE_VALUE, "failed to open mountmgr, error %lu\n", GetLastError());
1822
1823 io.Status = 0xdeadf00d;
1824 io.Information = 0xdeadf00d;
1827 ok(status == STATUS_INVALID_PARAMETER, "got %#lx\n", status);
1828 ok(io.Status == 0xdeadf00d, "got status %#lx\n", io.Status);
1829 ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
1830
1831 memset( input, 0, sizeof(*input) );
1832
1833 io.Status = 0xdeadf00d;
1834 io.Information = 0xdeadf00d;
1836 IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input) - 1, NULL, 0 );
1837 ok(status == STATUS_INVALID_PARAMETER, "got %#lx\n", status);
1838 ok(io.Status == 0xdeadf00d, "got status %#lx\n", io.Status);
1839 ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
1840
1841 io.Status = 0xdeadf00d;
1842 io.Information = 0xdeadf00d;
1845 ok(status == STATUS_INVALID_PARAMETER, "got %#lx\n", status);
1846 ok(io.Status == 0xdeadf00d, "got status %#lx\n", io.Status);
1847 ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
1848
1849 io.Status = 0xdeadf00d;
1850 io.Information = 0xdeadf00d;
1851 memset(output, 0xcc, sizeof(*output));
1853 IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, sizeof(*output) - 1 );
1854 ok(status == STATUS_INVALID_PARAMETER, "got %#lx\n", status);
1855 ok(io.Status == 0xdeadf00d, "got status %#lx\n", io.Status);
1856 ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
1857 ok(output->Size == 0xcccccccc, "got size %lu\n", output->Size);
1858 ok(output->NumberOfMountPoints == 0xcccccccc, "got count %lu\n", output->NumberOfMountPoints);
1859
1860 io.Status = 0xdeadf00d;
1861 io.Information = 0xdeadf00d;
1862 memset(output, 0xcc, sizeof(*output));
1864 IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, sizeof(*output) );
1865 ok(status == STATUS_BUFFER_OVERFLOW, "got %#lx\n", status);
1866 ok(io.Status == STATUS_BUFFER_OVERFLOW, "got status %#lx\n", io.Status);
1867#ifdef __REACTOS__
1868 todo_wine ok(io.Information == offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]) || broken(io.Information == sizeof(MOUNTMGR_MOUNT_POINTS)) /* WS03 */, "got information %#Ix\n", io.Information);
1869#else
1870 todo_wine ok(io.Information == offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]), "got information %#Ix\n", io.Information);
1871#endif
1872 ok(output->Size > offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]), "got size %lu\n", output->Size);
1873 todo_wine ok(output->NumberOfMountPoints && output->NumberOfMountPoints != 0xcccccccc,
1874 "got count %lu\n", output->NumberOfMountPoints);
1875
1876 output = realloc(output, output->Size);
1877
1878 io.Status = 0xdeadf00d;
1879 io.Information = 0xdeadf00d;
1881 IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, output->Size );
1882 ok(!status, "got %#lx\n", status);
1883 ok(!io.Status, "got status %#lx\n", io.Status);
1884 ok(io.Information == output->Size, "got size %lu, information %#Ix\n", output->Size, io.Information);
1885 ok(output->Size > offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]), "got size %lu\n", output->Size);
1886 ok(output->NumberOfMountPoints && output->NumberOfMountPoints != 0xcccccccc,
1887 "got count %lu\n", output->NumberOfMountPoints);
1888
1889 CloseHandle( file );
1890
1891 free(output);
1892}
1893
1895{
1896 hdll = GetModuleHandleA("kernel32.dll");
1897 pFindFirstVolumeA = (void *) GetProcAddress(hdll, "FindFirstVolumeA");
1898 pFindNextVolumeA = (void *) GetProcAddress(hdll, "FindNextVolumeA");
1899 pFindVolumeClose = (void *) GetProcAddress(hdll, "FindVolumeClose");
1900 pGetLogicalDriveStringsA = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsA");
1901 pGetLogicalDriveStringsW = (void *) GetProcAddress(hdll, "GetLogicalDriveStringsW");
1902 pGetVolumePathNamesForVolumeNameA = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameA");
1903 pGetVolumePathNamesForVolumeNameW = (void *) GetProcAddress(hdll, "GetVolumePathNamesForVolumeNameW");
1904 pCreateSymbolicLinkA = (void *) GetProcAddress(hdll, "CreateSymbolicLinkA");
1905 pGetVolumeInformationByHandleW = (void *) GetProcAddress(hdll, "GetVolumeInformationByHandleW");
1906
1926}
#define GetNTVersion()
Definition: apitest.h:17
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAY_SIZE(A)
Definition: main.h:20
#define IOCTL_DVD_READ_STRUCTURE
Definition: cdrw_usr.h:157
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define _strdup
Definition: debug_ros.c:7
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR empty[]
Definition: main.c:47
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define wcsnicmp
Definition: compat.h:14
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define FILE_SHARE_READ
Definition: compat.h:136
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:422
BOOL WINAPI DefineDosDeviceA(DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath)
Definition: dosdev.c:162
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:219
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
BOOL WINAPI GetVolumeInformationA(IN LPCSTR lpRootPathName, IN LPSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:32
BOOL WINAPI GetVolumePathNameA(IN LPCSTR lpszFileName, IN LPSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:751
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:815
BOOL WINAPI GetVolumePathNamesForVolumeNameA(IN LPCSTR lpszVolumeName, IN LPSTR lpszVolumePathNames, IN DWORD cchBufferLength, OUT PDWORD lpcchReturnLength)
Definition: volume.c:1117
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
DWORD WINAPI DECLSPEC_HOTPATCH GetLogicalDrives(void)
Definition: volume.c:513
int CDECL tolower(int c)
Definition: ctype.c:572
int CDECL toupper(int c)
Definition: ctype.c:514
#define DECLSPEC_ALIGN(x)
Definition: corecrt.h:141
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3415
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3330
unsigned char
Definition: typeof.h:29
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
struct _DVD_DESCRIPTOR_HEADER DVD_DESCRIPTOR_HEADER
struct _DVD_COPYRIGHT_DESCRIPTOR DVD_COPYRIGHT_DESCRIPTOR
#define strcasecmp
Definition: fake.h:9
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ FileAttributeTagInformation
Definition: from_kernel.h:96
@ FileNameInformation
Definition: from_kernel.h:70
@ FileFsAttributeInformation
Definition: from_kernel.h:223
@ FileFsVolumeInformation
Definition: from_kernel.h:219
uint32_t serial
Definition: fsck.fat.h:29
static char * path_name(DOS_FILE *file)
Definition: check.c:208
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define C_ASSERT(e)
Definition: intsafe.h:73
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
#define DRIVE_CDROM
Definition: machpc98.h:119
#define win_skip
Definition: minitest.h:67
#define todo_wine
Definition: minitest.h:80
static char volume_name[]
Definition: mkdosfs.c:526
#define error(str)
Definition: mkdosfs.c:1605
BOOL WINAPI GetVolumeNameForVolumeMountPointA(IN LPCSTR lpszVolumeMountPoint, IN LPSTR lpszVolumeName, IN DWORD cchBufferLength)
Definition: mntpoint.c:518
BOOL WINAPI DeleteVolumeMountPointA(IN LPCSTR lpszVolumeMountPoint)
Definition: mntpoint.c:607
BOOL WINAPI SetVolumeMountPointA(IN LPCSTR lpszVolumeMountPoint, IN LPCSTR lpszVolumeName)
Definition: mntpoint.c:595
BOOL WINAPI GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, OUT LPWSTR VolumeName, IN DWORD VolumeNameLength)
Definition: mntpoint.c:496
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
static DWORD path_len
Definition: batch.c:31
static const WCHAR label[]
Definition: itemdlg.c:1546
static void test_GetLogicalDriveStringsA(void)
Definition: volume.c:349
static void test_GetVolumeInformationByHandle(void)
Definition: volume.c:1690
static LPSTR
Definition: volume.c:55
static void test_disk_query_property(void)
Definition: volume.c:648
static void test_dvd_read_structure(HANDLE handle)
Definition: volume.c:1202
static void test_GetVolumePathNameA(void)
Definition: volume.c:733
static void test_GetVolumeInformationA(void)
Definition: volume.c:422
static void test_query_dos_deviceA(void)
Definition: volume.c:66
static void test_FindFirstVolume(void)
Definition: volume.c:222
static LPWSTR
Definition: volume.c:58
static void test_cdrom_ioctl(void)
Definition: volume.c:1323
static void test_mounted_folder(void)
Definition: volume.c:1366
static void test_enum_vols(void)
Definition: volume.c:581
static void test_GetVolumePathNameW(void)
Definition: volume.c:1002
static DWORD
Definition: volume.c:54
static void test_GetVolumePathNamesForVolumeNameW(void)
Definition: volume.c:1122
static void test_GetLogicalDriveStringsW(void)
Definition: volume.c:383
static HINSTANCE hdll
Definition: volume.c:53
static void test_mountmgr_query_points(void)
Definition: volume.c:1809
static void test_dos_devices(void)
Definition: volume.c:112
static LPDWORD
Definition: volume.c:59
static void test_GetVolumePathNamesForVolumeNameA(void)
Definition: volume.c:1039
static void test_GetVolumeNameForVolumeMountPointA(void)
Definition: volume.c:256
static void test_GetVolumeNameForVolumeMountPointW(void)
Definition: volume.c:325
static void test_disk_extents(void)
Definition: volume.c:621
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
static LPCWSTR file_name
Definition: protocol.c:147
#define IOCTL_MOUNTMGR_QUERY_POINTS
Definition: mountmgr.h:49
#define MOUNTMGR_DOS_DEVICE_NAME
Definition: mountmgr.h:37
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define BOOL
Definition: nt_native.h:43
#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
Definition: ntddvol.h:44
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:178
@ StorageDeviceSeekPenaltyProperty
Definition: ntddstor.h:519
@ StorageDeviceProperty
Definition: ntddstor.h:512
@ PropertyStandardQuery
Definition: ntddstor.h:505
#define offsetof(TYPE, MEMBER)
descriptor
Definition: scsi.h:3997
strcat
Definition: string.h:92
#define is_reactos()
Definition: test.h:1041
#define memset(x, y, z)
Definition: compat.h:39
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
DVD_DESCRIPTOR_HEADER Header
Definition: volume.c:36
DVD_LAYER_DESCRIPTOR Descriptor
Definition: volume.c:37
DVD_MANUFACTURER_DESCRIPTOR Descriptor
Definition: volume.c:47
DVD_DESCRIPTOR_HEADER Header
Definition: volume.c:46
LARGE_INTEGER BlockByteOffset
Definition: ntddcdvd.h:119
DVD_SESSION_ID SessionId
Definition: ntddcdvd.h:121
DVD_STRUCTURE_FORMAT Format
Definition: ntddcdvd.h:120
UCHAR Reserved[2]
Definition: scsi.h:2845
Definition: fci.c:127
Definition: name.c:39
Definition: ps.c:97
PVOID HANDLE
Definition: typedefs.h:73
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONGLONG QuadPart
Definition: typedefs.h:114
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static const char * sysroot
Definition: widl.c:142
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DDD_RAW_TARGET_PATH
Definition: winbase.h:503
#define DDD_REMOVE_DEFINITION
Definition: winbase.h:504
#define WINAPI
Definition: msvc.h:6
#define ERROR_BAD_LENGTH
Definition: winerror.h:249
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228
#define ERROR_GEN_FAILURE
Definition: winerror.h:256
#define ERROR_NOT_READY
Definition: winerror.h:246
#define ERROR_NO_MORE_FILES
Definition: winerror.h:243
#define ERROR_DIR_NOT_ROOT
Definition: winerror.h:338
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:385
#define ERROR_NOT_A_REPARSE_POINT
Definition: winerror.h:1717
#define IO_REPARSE_TAG_MOUNT_POINT
Definition: iotypes.h:7234
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180