2 * Unit test suite for volume functions
4 * Copyright 2006 Stefan Leichter
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
25 #include "ddk/ntddcdvd.h"
28 struct COMPLETE_DVD_LAYER_DESCRIPTOR
30 DVD_DESCRIPTOR_HEADER Header
;
31 DVD_LAYER_DESCRIPTOR Descriptor
;
35 C_ASSERT(sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR
) == 22);
38 struct COMPLETE_DVD_MANUFACTURER_DESCRIPTOR
40 DVD_DESCRIPTOR_HEADER Header
;
41 DVD_MANUFACTURER_DESCRIPTOR Descriptor
;
45 C_ASSERT(sizeof(struct COMPLETE_DVD_MANUFACTURER_DESCRIPTOR
) == 2053);
47 static HINSTANCE hdll
;
48 static BOOL (WINAPI
* pGetVolumeNameForVolumeMountPointA
)(LPCSTR
, LPSTR
, DWORD
);
49 static BOOL (WINAPI
* pGetVolumeNameForVolumeMountPointW
)(LPCWSTR
, LPWSTR
, DWORD
);
50 static HANDLE (WINAPI
*pFindFirstVolumeA
)(LPSTR
,DWORD
);
51 static BOOL (WINAPI
*pFindNextVolumeA
)(HANDLE
,LPSTR
,DWORD
);
52 static BOOL (WINAPI
*pFindVolumeClose
)(HANDLE
);
53 static UINT (WINAPI
*pGetLogicalDriveStringsA
)(UINT
,LPSTR
);
54 static UINT (WINAPI
*pGetLogicalDriveStringsW
)(UINT
,LPWSTR
);
55 static BOOL (WINAPI
*pGetVolumeInformationA
)(LPCSTR
, LPSTR
, DWORD
, LPDWORD
, LPDWORD
, LPDWORD
, LPSTR
, DWORD
);
56 static BOOL (WINAPI
*pGetVolumePathNameA
)(LPCSTR
, LPSTR
, DWORD
);
57 static BOOL (WINAPI
*pGetVolumePathNamesForVolumeNameA
)(LPCSTR
, LPSTR
, DWORD
, LPDWORD
);
58 static BOOL (WINAPI
*pGetVolumePathNamesForVolumeNameW
)(LPCWSTR
, LPWSTR
, DWORD
, LPDWORD
);
60 /* ############################### */
62 static void test_query_dos_deviceA(void)
64 char drivestr
[] = "a:";
65 char *p
, *buffer
, buffer2
[2000];
66 DWORD ret
, ret2
, buflen
=32768;
69 /* callers must guess the buffer size */
70 SetLastError(0xdeadbeef);
71 ret
= QueryDosDeviceA( NULL
, NULL
, 0 );
72 ok(!ret
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
,
73 "QueryDosDeviceA(no buffer): returned %u, le=%u\n", ret
, GetLastError());
75 buffer
= HeapAlloc( GetProcessHeap(), 0, buflen
);
76 SetLastError(0xdeadbeef);
77 ret
= QueryDosDeviceA( NULL
, buffer
, buflen
);
78 ok((ret
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER
),
79 "QueryDosDeviceA failed to return list, last error %u\n", GetLastError());
81 if (ret
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER
) {
84 if (!strlen(p
)) break;
85 ret2
= QueryDosDeviceA( p
, buffer2
, sizeof(buffer2
) );
86 ok(ret2
, "QueryDosDeviceA failed to return current mapping for %s, last error %u\n", p
, GetLastError());
88 if (ret
<= (p
-buffer
)) break;
92 for (;drivestr
[0] <= 'z'; drivestr
[0]++) {
93 /* Older W2K fails with ERROR_INSUFFICIENT_BUFFER when buflen is > 32767 */
94 ret
= QueryDosDeviceA( drivestr
, buffer
, buflen
- 1);
95 ok(ret
|| GetLastError() == ERROR_FILE_NOT_FOUND
,
96 "QueryDosDeviceA failed to return current mapping for %s, last error %u\n", drivestr
, GetLastError());
98 for (p
= buffer
; *p
; p
++) *p
= toupper(*p
);
99 if (strstr(buffer
, "HARDDISK") || strstr(buffer
, "RAMDISK")) found
= TRUE
;
102 ok(found
, "expected at least one devicename to contain HARDDISK or RAMDISK\n");
103 HeapFree( GetProcessHeap(), 0, buffer
);
106 static void test_define_dos_deviceA(void)
112 /* Find an unused drive letter */
115 for (drivestr
[0] = 'a'; drivestr
[0] <= 'z'; drivestr
[0]++) {
116 ret
= QueryDosDeviceA( drivestr
, buf
, sizeof(buf
));
119 if (drivestr
[0] > 'z') {
120 skip("can't test creating a dos drive, none available\n");
124 /* Map it to point to the current directory */
125 ret
= GetCurrentDirectoryA(sizeof(buf
), buf
);
126 ok(ret
, "GetCurrentDir\n");
128 ret
= DefineDosDeviceA(0, drivestr
, buf
);
130 ok(ret
, "Could not make drive %s point to %s!\n", drivestr
, buf
);
133 skip("can't test removing fake drive\n");
135 ret
= DefineDosDeviceA(DDD_REMOVE_DEFINITION
, drivestr
, NULL
);
136 ok(ret
, "Could not remove fake drive %s!\n", drivestr
);
140 static void test_FindFirstVolume(void)
145 /* not present before w2k */
146 if (!pFindFirstVolumeA
) {
147 win_skip("FindFirstVolumeA not found\n");
151 handle
= pFindFirstVolumeA( volume
, 0 );
152 ok( handle
== INVALID_HANDLE_VALUE
, "succeeded with short buffer\n" );
153 ok( GetLastError() == ERROR_MORE_DATA
|| /* XP */
154 GetLastError() == ERROR_FILENAME_EXCED_RANGE
, /* Vista */
155 "wrong error %u\n", GetLastError() );
156 handle
= pFindFirstVolumeA( volume
, 49 );
157 ok( handle
== INVALID_HANDLE_VALUE
, "succeeded with short buffer\n" );
158 ok( GetLastError() == ERROR_FILENAME_EXCED_RANGE
, "wrong error %u\n", GetLastError() );
159 handle
= pFindFirstVolumeA( volume
, 51 );
160 ok( handle
!= INVALID_HANDLE_VALUE
, "failed err %u\n", GetLastError() );
161 if (handle
!= INVALID_HANDLE_VALUE
)
165 ok( strlen(volume
) == 49, "bad volume name %s\n", volume
);
166 ok( !memcmp( volume
, "\\\\?\\Volume{", 11 ), "bad volume name %s\n", volume
);
167 ok( !memcmp( volume
+ 47, "}\\", 2 ), "bad volume name %s\n", volume
);
168 } while (pFindNextVolumeA( handle
, volume
, MAX_PATH
));
169 ok( GetLastError() == ERROR_NO_MORE_FILES
, "wrong error %u\n", GetLastError() );
170 pFindVolumeClose( handle
);
174 static void test_GetVolumeNameForVolumeMountPointA(void)
177 char volume
[MAX_PATH
], path
[] = "c:\\";
178 DWORD len
= sizeof(volume
), reti
;
179 char temp_path
[MAX_PATH
];
181 /* not present before w2k */
182 if (!pGetVolumeNameForVolumeMountPointA
) {
183 win_skip("GetVolumeNameForVolumeMountPointA not found\n");
187 reti
= GetTempPathA(MAX_PATH
, temp_path
);
188 ok(reti
!= 0, "GetTempPathA error %d\n", GetLastError());
189 ok(reti
< MAX_PATH
, "temp path should fit into MAX_PATH\n");
191 ret
= pGetVolumeNameForVolumeMountPointA(path
, volume
, 0);
192 ok(ret
== FALSE
, "GetVolumeNameForVolumeMountPointA succeeded\n");
193 ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE
||
194 GetLastError() == ERROR_INVALID_PARAMETER
, /* Vista */
195 "wrong error, last=%d\n", GetLastError());
197 if (0) { /* these crash on XP */
198 ret
= pGetVolumeNameForVolumeMountPointA(path
, NULL
, len
);
199 ok(ret
== FALSE
, "GetVolumeNameForVolumeMountPointA succeeded\n");
201 ret
= pGetVolumeNameForVolumeMountPointA(NULL
, volume
, len
);
202 ok(ret
== FALSE
, "GetVolumeNameForVolumeMountPointA succeeded\n");
205 ret
= pGetVolumeNameForVolumeMountPointA(path
, volume
, len
);
206 ok(ret
== TRUE
, "GetVolumeNameForVolumeMountPointA failed\n");
207 ok(!strncmp( volume
, "\\\\?\\Volume{", 11),
208 "GetVolumeNameForVolumeMountPointA failed to return valid string <%s>\n",
211 /* test with too small buffer */
212 ret
= pGetVolumeNameForVolumeMountPointA(path
, volume
, 10);
213 ok(ret
== FALSE
&& GetLastError() == ERROR_FILENAME_EXCED_RANGE
,
214 "GetVolumeNameForVolumeMountPointA failed, wrong error returned, was %d, should be ERROR_FILENAME_EXCED_RANGE\n",
217 /* Try on an arbitrary directory */
218 /* On FAT filesystems it seems that GetLastError() is set to
219 ERROR_INVALID_FUNCTION. */
220 ret
= pGetVolumeNameForVolumeMountPointA(temp_path
, volume
, len
);
221 ok(ret
== FALSE
&& (GetLastError() == ERROR_NOT_A_REPARSE_POINT
||
222 GetLastError() == ERROR_INVALID_FUNCTION
),
223 "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
224 temp_path
, GetLastError());
226 /* Try on a nonexistent dos drive */
228 for (;path
[0] <= 'z'; path
[0]++) {
229 ret
= QueryDosDeviceA( path
, volume
, len
);
235 ret
= pGetVolumeNameForVolumeMountPointA(path
, volume
, len
);
236 ok(ret
== FALSE
&& GetLastError() == ERROR_FILE_NOT_FOUND
,
237 "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
238 path
, GetLastError());
240 /* Try without trailing \ and on a nonexistent dos drive */
242 ret
= pGetVolumeNameForVolumeMountPointA(path
, volume
, len
);
243 ok(ret
== FALSE
&& GetLastError() == ERROR_INVALID_NAME
,
244 "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
245 path
, GetLastError());
249 static void test_GetVolumeNameForVolumeMountPointW(void)
252 WCHAR volume
[MAX_PATH
], path
[] = {'c',':','\\',0};
253 DWORD len
= sizeof(volume
) / sizeof(WCHAR
);
255 /* not present before w2k */
256 if (!pGetVolumeNameForVolumeMountPointW
) {
257 win_skip("GetVolumeNameForVolumeMountPointW not found\n");
261 ret
= pGetVolumeNameForVolumeMountPointW(path
, volume
, 0);
262 ok(ret
== FALSE
, "GetVolumeNameForVolumeMountPointA succeeded\n");
263 ok(GetLastError() == ERROR_FILENAME_EXCED_RANGE
||
264 GetLastError() == ERROR_INVALID_PARAMETER
, /* Vista */
265 "wrong error, last=%d\n", GetLastError());
267 if (0) { /* these crash on XP */
268 ret
= pGetVolumeNameForVolumeMountPointW(path
, NULL
, len
);
269 ok(ret
== FALSE
, "GetVolumeNameForVolumeMountPointW succeeded\n");
271 ret
= pGetVolumeNameForVolumeMountPointW(NULL
, volume
, len
);
272 ok(ret
== FALSE
, "GetVolumeNameForVolumeMountPointW succeeded\n");
275 ret
= pGetVolumeNameForVolumeMountPointW(path
, volume
, len
);
276 ok(ret
== TRUE
, "GetVolumeNameForVolumeMountPointW failed\n");
279 static void test_GetLogicalDriveStringsA(void)
284 ok( pGetLogicalDriveStringsA
!= NULL
, "GetLogicalDriveStringsA not available\n");
285 if(!pGetLogicalDriveStringsA
) {
289 size
= pGetLogicalDriveStringsA(0, NULL
);
290 ok(size
%4 == 1, "size = %d\n", size
);
292 buf
= HeapAlloc(GetProcessHeap(), 0, size
);
295 size2
= pGetLogicalDriveStringsA(2, buf
);
296 ok(size2
== size
, "size2 = %d\n", size2
);
297 ok(!*buf
, "buf changed\n");
299 size2
= pGetLogicalDriveStringsA(size
, buf
);
300 ok(size2
== size
-1, "size2 = %d\n", size2
);
302 for(ptr
= buf
; ptr
< buf
+size2
; ptr
+= 4) {
303 ok(('A' <= *ptr
&& *ptr
<= 'Z'), "device name '%c' is not uppercase\n", *ptr
);
304 ok(ptr
[1] == ':', "ptr[1] = %c, expected ':'\n", ptr
[1]);
305 ok(ptr
[2] == '\\', "ptr[2] = %c expected '\\'\n", ptr
[2]);
306 ok(!ptr
[3], "ptr[3] = %c expected nullbyte\n", ptr
[3]);
308 ok(!*ptr
, "buf[size2] is not nullbyte\n");
310 HeapFree(GetProcessHeap(), 0, buf
);
313 static void test_GetLogicalDriveStringsW(void)
318 ok( pGetLogicalDriveStringsW
!= NULL
, "GetLogicalDriveStringsW not available\n");
319 if(!pGetLogicalDriveStringsW
) {
323 SetLastError(0xdeadbeef);
324 size
= pGetLogicalDriveStringsW(0, NULL
);
325 if (size
== 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
) {
326 win_skip("GetLogicalDriveStringsW not implemented\n");
329 ok(size
%4 == 1, "size = %d\n", size
);
331 buf
= HeapAlloc(GetProcessHeap(), 0, size
*sizeof(WCHAR
));
334 size2
= pGetLogicalDriveStringsW(2, buf
);
335 ok(size2
== size
, "size2 = %d\n", size2
);
336 ok(!*buf
, "buf changed\n");
338 size2
= pGetLogicalDriveStringsW(size
, buf
);
339 ok(size2
== size
-1, "size2 = %d\n", size2
);
341 for(ptr
= buf
; ptr
< buf
+size2
; ptr
+= 4) {
342 ok('A' <= *ptr
&& *ptr
<= 'Z', "device name '%c' is not uppercase\n", *ptr
);
343 ok(ptr
[1] == ':', "ptr[1] = %c, expected ':'\n", ptr
[1]);
344 ok(ptr
[2] == '\\', "ptr[2] = %c expected '\\'\n", ptr
[2]);
345 ok(!ptr
[3], "ptr[3] = %c expected nullbyte\n", ptr
[3]);
347 ok(!*ptr
, "buf[size2] is not nullbyte\n");
349 HeapFree(GetProcessHeap(), 0, buf
);
352 static void test_GetVolumeInformationA(void)
356 char Root_Colon
[]="C:";
357 char Root_Slash
[]="C:\\";
358 char Root_UNC
[]="\\\\?\\C:\\";
359 char volume
[MAX_PATH
+1];
360 DWORD vol_name_size
=MAX_PATH
+1, vol_serial_num
=-1, max_comp_len
=0, fs_flags
=0, fs_name_len
=MAX_PATH
+1;
361 char vol_name_buf
[MAX_PATH
+1], fs_name_buf
[MAX_PATH
+1];
362 char windowsdir
[MAX_PATH
+10];
363 char currentdir
[MAX_PATH
+1];
365 ok( pGetVolumeInformationA
!= NULL
, "GetVolumeInformationA not found\n");
366 if(!pGetVolumeInformationA
) {
370 /* get windows drive letter and update strings for testing */
371 result
= GetWindowsDirectoryA(windowsdir
, sizeof(windowsdir
));
372 ok(result
< sizeof(windowsdir
), "windowsdir is abnormally long!\n");
373 ok(result
!= 0, "GetWindowsDirectory: error %d\n", GetLastError());
374 Root_Colon
[0] = windowsdir
[0];
375 Root_Slash
[0] = windowsdir
[0];
376 Root_UNC
[4] = windowsdir
[0];
378 result
= GetCurrentDirectoryA(MAX_PATH
, currentdir
);
379 ok(result
, "GetCurrentDirectory: error %d\n", GetLastError());
380 /* Note that GetCurrentDir yields no trailing slash for subdirs */
382 /* check for NO error on no trailing \ when current dir is root dir */
383 ret
= SetCurrentDirectoryA(Root_Slash
);
384 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
385 ret
= pGetVolumeInformationA(Root_Colon
, vol_name_buf
, vol_name_size
, NULL
,
386 NULL
, NULL
, fs_name_buf
, fs_name_len
);
387 ok(ret
, "GetVolumeInformationA root failed, last error %u\n", GetLastError());
389 /* check for error on no trailing \ when current dir is subdir (windows) of queried drive */
390 ret
= SetCurrentDirectoryA(windowsdir
);
391 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
392 SetLastError(0xdeadbeef);
393 ret
= pGetVolumeInformationA(Root_Colon
, vol_name_buf
, vol_name_size
, NULL
,
394 NULL
, NULL
, fs_name_buf
, fs_name_len
);
395 ok(!ret
&& (GetLastError() == ERROR_INVALID_NAME
),
396 "GetVolumeInformationA did%s fail, last error %u\n", ret
? " not":"", GetLastError());
398 /* reset current directory */
399 ret
= SetCurrentDirectoryA(currentdir
);
400 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
402 if (toupper(currentdir
[0]) == toupper(windowsdir
[0])) {
403 skip("Please re-run from another device than %c:\n", windowsdir
[0]);
404 /* FIXME: Use GetLogicalDrives to find another device to avoid this skip. */
406 char Root_Env
[]="=C:"; /* where MS maintains the per volume directory */
407 Root_Env
[1] = windowsdir
[0];
409 /* C:\windows becomes the current directory on drive C: */
410 /* Note that paths to subdirs are stored without trailing slash, like what GetCurrentDir yields. */
411 ret
= SetEnvironmentVariableA(Root_Env
, windowsdir
);
412 ok(ret
, "SetEnvironmentVariable %s failed\n", Root_Env
);
414 ret
= SetCurrentDirectoryA(windowsdir
);
415 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
416 ret
= SetCurrentDirectoryA(currentdir
);
417 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
419 /* windows dir is current on the root drive, call fails */
420 SetLastError(0xdeadbeef);
421 ret
= pGetVolumeInformationA(Root_Colon
, vol_name_buf
, vol_name_size
, NULL
,
422 NULL
, NULL
, fs_name_buf
, fs_name_len
);
423 ok(!ret
&& (GetLastError() == ERROR_INVALID_NAME
),
424 "GetVolumeInformationA did%s fail, last error %u\n", ret
? " not":"", GetLastError());
426 /* Try normal drive letter with trailing \ */
427 ret
= pGetVolumeInformationA(Root_Slash
, vol_name_buf
, vol_name_size
, NULL
,
428 NULL
, NULL
, fs_name_buf
, fs_name_len
);
429 ok(ret
, "GetVolumeInformationA with \\ failed, last error %u\n", GetLastError());
431 ret
= SetCurrentDirectoryA(Root_Slash
);
432 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
433 ret
= SetCurrentDirectoryA(currentdir
);
434 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
436 /* windows dir is STILL CURRENT on root drive; the call fails as before, */
437 /* proving that SetCurrentDir did not remember the other drive's directory */
438 SetLastError(0xdeadbeef);
439 ret
= pGetVolumeInformationA(Root_Colon
, vol_name_buf
, vol_name_size
, NULL
,
440 NULL
, NULL
, fs_name_buf
, fs_name_len
);
441 ok(!ret
&& (GetLastError() == ERROR_INVALID_NAME
),
442 "GetVolumeInformationA did%s fail, last error %u\n", ret
? " not":"", GetLastError());
444 /* Now C:\ becomes the current directory on drive C: */
445 ret
= SetEnvironmentVariableA(Root_Env
, Root_Slash
); /* set =C:=C:\ */
446 ok(ret
, "SetEnvironmentVariable %s failed\n", Root_Env
);
448 /* \ is current on root drive, call succeeds */
449 ret
= pGetVolumeInformationA(Root_Colon
, vol_name_buf
, vol_name_size
, NULL
,
450 NULL
, NULL
, fs_name_buf
, fs_name_len
);
451 ok(ret
, "GetVolumeInformationA failed, last error %u\n", GetLastError());
453 /* again, SetCurrentDirectory on another drive does not matter */
454 ret
= SetCurrentDirectoryA(Root_Slash
);
455 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
456 ret
= SetCurrentDirectoryA(currentdir
);
457 ok(ret
, "SetCurrentDirectory: error %d\n", GetLastError());
459 /* \ is current on root drive, call succeeds */
460 ret
= pGetVolumeInformationA(Root_Colon
, vol_name_buf
, vol_name_size
, NULL
,
461 NULL
, NULL
, fs_name_buf
, fs_name_len
);
462 ok(ret
, "GetVolumeInformationA failed, last error %u\n", GetLastError());
465 /* try null root directory to return "root of the current directory" */
466 ret
= pGetVolumeInformationA(NULL
, vol_name_buf
, vol_name_size
, NULL
,
467 NULL
, NULL
, fs_name_buf
, fs_name_len
);
468 ok(ret
, "GetVolumeInformationA failed on null root dir, last error %u\n", GetLastError());
470 /* Try normal drive letter with trailing \ */
471 ret
= pGetVolumeInformationA(Root_Slash
, vol_name_buf
, vol_name_size
,
472 &vol_serial_num
, &max_comp_len
, &fs_flags
, fs_name_buf
, fs_name_len
);
473 ok(ret
, "GetVolumeInformationA failed, root=%s, last error=%u\n", Root_Slash
, GetLastError());
475 /* try again with drive letter and the "disable parsing" prefix */
476 SetLastError(0xdeadbeef);
477 ret
= pGetVolumeInformationA(Root_UNC
, vol_name_buf
, vol_name_size
,
478 &vol_serial_num
, &max_comp_len
, &fs_flags
, fs_name_buf
, fs_name_len
);
479 ok(ret
, "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret
? " not":"", Root_UNC
, GetLastError());
481 /* try again with device name space */
483 SetLastError(0xdeadbeef);
484 ret
= pGetVolumeInformationA(Root_UNC
, vol_name_buf
, vol_name_size
,
485 &vol_serial_num
, &max_comp_len
, &fs_flags
, fs_name_buf
, fs_name_len
);
486 ok(ret
, "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret
? " not":"", Root_UNC
, GetLastError());
488 /* try again with a directory off the root - should generate error */
489 if (windowsdir
[strlen(windowsdir
)-1] != '\\') strcat(windowsdir
, "\\");
490 SetLastError(0xdeadbeef);
491 ret
= pGetVolumeInformationA(windowsdir
, vol_name_buf
, vol_name_size
,
492 &vol_serial_num
, &max_comp_len
, &fs_flags
, fs_name_buf
, fs_name_len
);
493 ok(!ret
&& (GetLastError()==ERROR_DIR_NOT_ROOT
),
494 "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret
? " not":"", windowsdir
, GetLastError());
495 /* A subdir with trailing \ yields DIR_NOT_ROOT instead of INVALID_NAME */
496 if (windowsdir
[strlen(windowsdir
)-1] == '\\') windowsdir
[strlen(windowsdir
)-1] = 0;
497 SetLastError(0xdeadbeef);
498 ret
= pGetVolumeInformationA(windowsdir
, vol_name_buf
, vol_name_size
,
499 &vol_serial_num
, &max_comp_len
, &fs_flags
, fs_name_buf
, fs_name_len
);
500 ok(!ret
&& (GetLastError()==ERROR_INVALID_NAME
),
501 "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret
? " not":"", windowsdir
, GetLastError());
503 if (!pGetVolumeNameForVolumeMountPointA
) {
504 win_skip("GetVolumeNameForVolumeMountPointA not found\n");
507 /* get the unique volume name for the windows drive */
508 ret
= pGetVolumeNameForVolumeMountPointA(Root_Slash
, volume
, MAX_PATH
);
509 ok(ret
== TRUE
, "GetVolumeNameForVolumeMountPointA failed\n");
511 /* try again with unique volume name */
512 ret
= pGetVolumeInformationA(volume
, vol_name_buf
, vol_name_size
,
513 &vol_serial_num
, &max_comp_len
, &fs_flags
, fs_name_buf
, fs_name_len
);
514 ok(ret
, "GetVolumeInformationA failed, root=%s, last error=%u\n", volume
, GetLastError());
517 /* Test to check that unique volume name from windows dir mount point */
518 /* matches at least one of the unique volume names returned from the */
519 /* FindFirstVolumeA/FindNextVolumeA list. */
520 static void test_enum_vols(void)
523 HANDLE hFind
= INVALID_HANDLE_VALUE
;
524 char Volume_1
[MAX_PATH
] = {0};
525 char Volume_2
[MAX_PATH
] = {0};
526 char path
[] = "c:\\";
528 char windowsdir
[MAX_PATH
];
530 if (!pGetVolumeNameForVolumeMountPointA
) {
531 win_skip("GetVolumeNameForVolumeMountPointA not found\n");
535 /*get windows drive letter and update strings for testing */
536 ret
= GetWindowsDirectoryA( windowsdir
, sizeof(windowsdir
) );
537 ok(ret
< sizeof(windowsdir
), "windowsdir is abnormally long!\n");
538 ok(ret
!= 0, "GetWindowsDirecory: error %d\n", GetLastError());
539 path
[0] = windowsdir
[0];
541 /* get the unique volume name for the windows drive */
542 ret
= pGetVolumeNameForVolumeMountPointA( path
, Volume_1
, MAX_PATH
);
543 ok(ret
== TRUE
, "GetVolumeNameForVolumeMountPointA failed\n");
544 ok(strlen(Volume_1
) == 49, "GetVolumeNameForVolumeMountPointA returned wrong length name %s\n", Volume_1
);
546 /* get first unique volume name of list */
547 hFind
= pFindFirstVolumeA( Volume_2
, MAX_PATH
);
548 ok(hFind
!= INVALID_HANDLE_VALUE
, "FindFirstVolume failed, err=%u\n",
553 /* validate correct length of unique volume name */
554 ok(strlen(Volume_2
) == 49, "Find[First/Next]Volume returned wrong length name %s\n", Volume_1
);
555 if (memcmp(Volume_1
, Volume_2
, 49) == 0)
560 } while (pFindNextVolumeA( hFind
, Volume_2
, MAX_PATH
));
561 ok(found
, "volume name %s not found by Find[First/Next]Volume\n", Volume_1
);
562 pFindVolumeClose( hFind
);
565 static void test_disk_extents(void)
570 static DWORD data
[16];
572 handle
= CreateFileA( "\\\\.\\c:", GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, 0, 0 );
573 if (handle
== INVALID_HANDLE_VALUE
)
575 win_skip("can't open c: drive %u\n", GetLastError());
579 ret
= DeviceIoControl( handle
, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
, &data
,
580 sizeof(data
), &data
, sizeof(data
), &size
, NULL
);
581 if (!ret
&& GetLastError() == ERROR_INVALID_FUNCTION
)
583 win_skip("IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS not supported\n");
584 CloseHandle( handle
);
587 ok(ret
, "DeviceIoControl failed %u\n", GetLastError());
588 ok(size
== 32, "expected 32, got %u\n", size
);
589 CloseHandle( handle
);
592 static void test_GetVolumePathNameA(void)
595 char volume
[MAX_PATH
];
596 char expected
[] = "C:\\", pathC1
[] = "C:\\", pathC2
[] = "C::";
599 if (!pGetVolumePathNameA
)
601 win_skip("required functions not found\n");
605 SetLastError( 0xdeadbeef );
606 ret
= pGetVolumePathNameA(NULL
, NULL
, 0);
607 error
= GetLastError();
608 ok(!ret
, "expected failure\n");
609 ok(error
== ERROR_INVALID_PARAMETER
610 || broken( error
== 0xdeadbeef) /* <=XP */,
611 "expected ERROR_INVALID_PARAMETER got %u\n", error
);
613 SetLastError( 0xdeadbeef );
614 ret
= pGetVolumePathNameA("", NULL
, 0);
615 error
= GetLastError();
616 ok(!ret
, "expected failure\n");
617 ok(error
== ERROR_INVALID_PARAMETER
618 || broken( error
== 0xdeadbeef) /* <=XP */,
619 "expected ERROR_INVALID_PARAMETER got %u\n", error
);
621 SetLastError( 0xdeadbeef );
622 ret
= pGetVolumePathNameA(pathC1
, NULL
, 0);
623 error
= GetLastError();
624 ok(!ret
, "expected failure\n");
625 ok(error
== ERROR_INVALID_PARAMETER
626 || broken(error
== ERROR_FILENAME_EXCED_RANGE
) /* <=XP */,
627 "expected ERROR_INVALID_PARAMETER got %u\n", error
);
629 SetLastError( 0xdeadbeef );
630 ret
= pGetVolumePathNameA(pathC1
, volume
, 0);
631 error
= GetLastError();
632 ok(!ret
, "expected failure\n");
633 ok(error
== ERROR_INVALID_PARAMETER
634 || broken(error
== ERROR_FILENAME_EXCED_RANGE
) /* <=XP */,
635 "expected ERROR_INVALID_PARAMETER got %u\n", error
);
637 SetLastError( 0xdeadbeef );
638 ret
= pGetVolumePathNameA(pathC1
, volume
, 1);
639 error
= GetLastError();
640 ok(!ret
, "expected failure\n");
641 ok(error
== ERROR_FILENAME_EXCED_RANGE
, "expected ERROR_FILENAME_EXCED_RANGE got %u\n", error
);
644 ret
= pGetVolumePathNameA(pathC1
, volume
, sizeof(volume
));
645 ok(ret
, "expected success\n");
646 ok(!strcmp(expected
, volume
), "expected name '%s', returned '%s'\n", pathC1
, volume
);
648 pathC1
[0] = tolower(pathC1
[0]);
650 ret
= pGetVolumePathNameA(pathC1
, volume
, sizeof(volume
));
651 ok(ret
, "expected success\n");
653 ok(!strcmp(expected
, volume
) || broken(!strcasecmp(expected
, volume
)) /* <=XP */,
654 "expected name '%s', returned '%s'\n", expected
, volume
);
657 ret
= pGetVolumePathNameA(pathC2
, volume
, sizeof(volume
));
659 ok(ret
, "expected success\n");
661 ok(!strcmp(expected
, volume
), "expected name '%s', returned '%s'\n", expected
, volume
);
663 /* test an invalid path */
664 SetLastError( 0xdeadbeef );
665 ret
= pGetVolumePathNameA("\\\\$$$", volume
, 1);
666 error
= GetLastError();
667 ok(!ret
, "expected failure\n");
668 ok(error
== ERROR_INVALID_NAME
|| broken(ERROR_FILENAME_EXCED_RANGE
) /* <=2000 */,
669 "expected ERROR_INVALID_NAME got %u\n", error
);
672 static void test_GetVolumePathNamesForVolumeNameA(void)
675 char volume
[MAX_PATH
], buffer
[MAX_PATH
];
678 if (!pGetVolumePathNamesForVolumeNameA
|| !pGetVolumeNameForVolumeMountPointA
)
680 win_skip("required functions not found\n");
684 ret
= pGetVolumeNameForVolumeMountPointA( "c:\\", volume
, sizeof(volume
) );
685 ok(ret
, "failed to get volume name %u\n", GetLastError());
686 trace("c:\\ -> %s\n", volume
);
688 SetLastError( 0xdeadbeef );
689 ret
= pGetVolumePathNamesForVolumeNameA( NULL
, NULL
, 0, NULL
);
690 error
= GetLastError();
691 ok(!ret
, "expected failure\n");
692 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
694 SetLastError( 0xdeadbeef );
695 ret
= pGetVolumePathNamesForVolumeNameA( "", NULL
, 0, NULL
);
696 error
= GetLastError();
697 ok(!ret
, "expected failure\n");
698 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
700 SetLastError( 0xdeadbeef );
701 ret
= pGetVolumePathNamesForVolumeNameA( volume
, NULL
, 0, NULL
);
702 error
= GetLastError();
703 ok(!ret
, "expected failure\n");
704 ok(error
== ERROR_MORE_DATA
, "expected ERROR_MORE_DATA got %u\n", error
);
706 SetLastError( 0xdeadbeef );
707 ret
= pGetVolumePathNamesForVolumeNameA( volume
, buffer
, 0, NULL
);
708 error
= GetLastError();
709 ok(!ret
, "expected failure\n");
710 ok(error
== ERROR_MORE_DATA
, "expected ERROR_MORE_DATA got %u\n", error
);
712 memset( buffer
, 0xff, sizeof(buffer
) );
713 ret
= pGetVolumePathNamesForVolumeNameA( volume
, buffer
, sizeof(buffer
), NULL
);
714 ok(ret
, "failed to get path names %u\n", GetLastError());
715 ok(!strcmp( "C:\\", buffer
), "expected \"\\C:\" got \"%s\"\n", buffer
);
716 ok(!buffer
[4], "expected double null-terminated buffer\n");
719 SetLastError( 0xdeadbeef );
720 ret
= pGetVolumePathNamesForVolumeNameA( NULL
, NULL
, 0, &len
);
721 error
= GetLastError();
722 ok(!ret
, "expected failure\n");
723 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
726 SetLastError( 0xdeadbeef );
727 ret
= pGetVolumePathNamesForVolumeNameA( NULL
, NULL
, sizeof(buffer
), &len
);
728 error
= GetLastError();
729 ok(!ret
, "expected failure\n");
730 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
733 SetLastError( 0xdeadbeef );
734 ret
= pGetVolumePathNamesForVolumeNameA( NULL
, buffer
, sizeof(buffer
), &len
);
735 error
= GetLastError();
736 ok(!ret
, "expected failure\n");
737 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
740 SetLastError( 0xdeadbeef );
741 ret
= pGetVolumePathNamesForVolumeNameA( NULL
, buffer
, sizeof(buffer
), &len
);
742 error
= GetLastError();
743 ok(!ret
, "expected failure\n");
744 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
747 memset( buffer
, 0xff, sizeof(buffer
) );
748 ret
= pGetVolumePathNamesForVolumeNameA( volume
, buffer
, sizeof(buffer
), &len
);
749 ok(ret
, "failed to get path names %u\n", GetLastError());
750 ok(len
== 5 || broken(len
== 2), "expected 5 got %u\n", len
);
751 ok(!strcmp( "C:\\", buffer
), "expected \"\\C:\" got \"%s\"\n", buffer
);
752 ok(!buffer
[4], "expected double null-terminated buffer\n");
755 static void test_GetVolumePathNamesForVolumeNameW(void)
757 static const WCHAR empty
[] = {0};
758 static const WCHAR drive_c
[] = {'c',':','\\',0};
759 static const WCHAR volume_null
[] = {'\\','\\','?','\\','V','o','l','u','m','e',
760 '{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0',
761 '-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}','\\',0};
763 WCHAR volume
[MAX_PATH
], buffer
[MAX_PATH
];
766 if (!pGetVolumePathNamesForVolumeNameW
|| !pGetVolumeNameForVolumeMountPointW
)
768 win_skip("required functions not found\n");
772 ret
= pGetVolumeNameForVolumeMountPointW( drive_c
, volume
, sizeof(volume
)/sizeof(volume
[0]) );
773 ok(ret
, "failed to get volume name %u\n", GetLastError());
775 SetLastError( 0xdeadbeef );
776 ret
= pGetVolumePathNamesForVolumeNameW( empty
, NULL
, 0, NULL
);
777 error
= GetLastError();
778 ok(!ret
, "expected failure\n");
779 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
781 SetLastError( 0xdeadbeef );
782 ret
= pGetVolumePathNamesForVolumeNameW( volume
, NULL
, 0, NULL
);
783 error
= GetLastError();
784 ok(!ret
, "expected failure\n");
785 ok(error
== ERROR_MORE_DATA
, "expected ERROR_MORE_DATA got %u\n", error
);
787 SetLastError( 0xdeadbeef );
788 ret
= pGetVolumePathNamesForVolumeNameW( volume
, buffer
, 0, NULL
);
789 error
= GetLastError();
790 ok(!ret
, "expected failure\n");
791 ok(error
== ERROR_MORE_DATA
, "expected ERROR_MORE_DATA got %u\n", error
);
794 ret
= pGetVolumePathNamesForVolumeNameW( volume
, NULL
, sizeof(buffer
), NULL
);
795 ok(ret
, "failed to get path names %u\n", GetLastError());
798 ret
= pGetVolumePathNamesForVolumeNameW( volume
, buffer
, sizeof(buffer
), NULL
);
799 ok(ret
, "failed to get path names %u\n", GetLastError());
802 memset( buffer
, 0xff, sizeof(buffer
) );
803 ret
= pGetVolumePathNamesForVolumeNameW( volume
, buffer
, sizeof(buffer
), &len
);
804 ok(ret
, "failed to get path names %u\n", GetLastError());
805 ok(len
== 5, "expected 5 got %u\n", len
);
806 ok(!buffer
[4], "expected double null-terminated buffer\n");
810 volume
[lstrlenW( volume
) - 1] = 0;
811 SetLastError( 0xdeadbeef );
812 ret
= pGetVolumePathNamesForVolumeNameW( volume
, buffer
, sizeof(buffer
), &len
);
813 error
= GetLastError();
814 ok(!ret
, "expected failure\n");
815 ok(error
== ERROR_INVALID_NAME
, "expected ERROR_INVALID_NAME got %u\n", error
);
820 SetLastError( 0xdeadbeef );
821 ret
= pGetVolumePathNamesForVolumeNameW( volume
, buffer
, sizeof(buffer
), &len
);
822 error
= GetLastError();
823 ok(!ret
, "expected failure\n");
824 todo_wine
ok(error
== ERROR_INVALID_PARAMETER
, "expected ERROR_INVALID_PARAMETER got %u\n", error
);
827 lstrcpyW( volume
, volume_null
);
828 SetLastError( 0xdeadbeef );
829 ret
= pGetVolumePathNamesForVolumeNameW( volume
, buffer
, sizeof(buffer
), &len
);
830 error
= GetLastError();
831 ok(!ret
, "expected failure\n");
832 ok(error
== ERROR_FILE_NOT_FOUND
, "expected ERROR_FILE_NOT_FOUND got %u\n", error
);
835 static void test_dvd_read_structure(HANDLE handle
)
840 DVD_READ_STRUCTURE dvdReadStructure
;
841 DVD_LAYER_DESCRIPTOR dvdLayerDescriptor
;
842 struct COMPLETE_DVD_LAYER_DESCRIPTOR completeDvdLayerDescriptor
;
843 DVD_COPYRIGHT_DESCRIPTOR dvdCopyrightDescriptor
;
844 struct COMPLETE_DVD_MANUFACTURER_DESCRIPTOR completeDvdManufacturerDescriptor
;
846 dvdReadStructure
.BlockByteOffset
.QuadPart
= 0;
847 dvdReadStructure
.SessionId
= 0;
848 dvdReadStructure
.LayerNumber
= 0;
851 /* DvdPhysicalDescriptor */
852 dvdReadStructure
.Format
= 0;
854 SetLastError(0xdeadbeef);
856 /* Test whether this ioctl is supported */
857 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
858 &completeDvdLayerDescriptor
, sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR
), &nbBytes
, NULL
);
862 skip("IOCTL_DVD_READ_STRUCTURE not supported: %u\n", GetLastError());
866 /* Confirm there is always a header before the actual data */
867 ok( completeDvdLayerDescriptor
.Header
.Length
== 0x0802, "Length is 0x%04x instead of 0x0802\n", completeDvdLayerDescriptor
.Header
.Length
);
868 ok( completeDvdLayerDescriptor
.Header
.Reserved
[0] == 0, "Reserved[0] is %x instead of 0\n", completeDvdLayerDescriptor
.Header
.Reserved
[0]);
869 ok( completeDvdLayerDescriptor
.Header
.Reserved
[1] == 0, "Reserved[1] is %x instead of 0\n", completeDvdLayerDescriptor
.Header
.Reserved
[1]);
871 /* TODO: Also check completeDvdLayerDescriptor.Descriptor content (via IOCTL_SCSI_PASS_THROUGH_DIRECT ?) */
873 /* Insufficient output buffer */
874 for(i
=0; i
<sizeof(DVD_DESCRIPTOR_HEADER
); i
++)
876 SetLastError(0xdeadbeef);
878 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
879 &completeDvdLayerDescriptor
, i
, &nbBytes
, NULL
);
880 ok(!ret
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
,"IOCTL_DVD_READ_STRUCTURE should fail with small buffer\n");
883 SetLastError(0xdeadbeef);
885 /* On newer version, an output buffer of sizeof(DVD_READ_STRUCTURE) size fails.
886 I think this is to force developers to realize that there is a header before the actual content */
887 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
888 &dvdLayerDescriptor
, sizeof(DVD_LAYER_DESCRIPTOR
), &nbBytes
, NULL
);
889 ok( (!ret
&& GetLastError() == ERROR_INVALID_PARAMETER
) || broken(ret
) /* < Win7 */,
890 "IOCTL_DVD_READ_STRUCTURE should have failed\n");
892 SetLastError(0xdeadbeef);
894 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, NULL
, sizeof(DVD_READ_STRUCTURE
),
895 &completeDvdLayerDescriptor
, sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR
), &nbBytes
, NULL
);
896 ok( (!ret
&& GetLastError() == ERROR_INVALID_PARAMETER
),
897 "IOCTL_DVD_READ_STRUCTURE should have failed\n");
899 /* Test wrong input parameters */
900 for(i
=0; i
<sizeof(DVD_READ_STRUCTURE
); i
++)
902 SetLastError(0xdeadbeef);
904 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, i
,
905 &completeDvdLayerDescriptor
, sizeof(struct COMPLETE_DVD_LAYER_DESCRIPTOR
), &nbBytes
, NULL
);
906 ok( (!ret
&& GetLastError() == ERROR_INVALID_PARAMETER
),
907 "IOCTL_DVD_READ_STRUCTURE should have failed\n");
911 /* DvdCopyrightDescriptor */
912 dvdReadStructure
.Format
= 1;
914 SetLastError(0xdeadbeef);
916 /* Strangely, with NULL lpOutBuffer, last error is insufficient buffer, not invalid parameter as we could expect */
917 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
918 NULL
, sizeof(DVD_COPYRIGHT_DESCRIPTOR
), &nbBytes
, NULL
);
919 ok(!ret
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "IOCTL_DVD_READ_STRUCTURE should have failed %d %u\n", ret
, GetLastError());
921 for(i
=0; i
<sizeof(DVD_COPYRIGHT_DESCRIPTOR
); i
++)
923 SetLastError(0xdeadbeef);
925 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
926 &dvdCopyrightDescriptor
, i
, &nbBytes
, NULL
);
927 ok(!ret
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "IOCTL_DVD_READ_STRUCTURE should have failed %d %u\n", ret
, GetLastError());
931 /* DvdManufacturerDescriptor */
932 dvdReadStructure
.Format
= 4;
934 SetLastError(0xdeadbeef);
936 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
937 &completeDvdManufacturerDescriptor
, sizeof(DVD_MANUFACTURER_DESCRIPTOR
), &nbBytes
, NULL
);
938 ok(ret
|| broken(GetLastError() == ERROR_NOT_READY
),
939 "IOCTL_DVD_READ_STRUCTURE (DvdManufacturerDescriptor) failed, last error = %u\n", GetLastError());
943 /* Confirm there is always a header before the actual data */
944 ok( completeDvdManufacturerDescriptor
.Header
.Length
== 0x0802, "Length is 0x%04x instead of 0x0802\n", completeDvdManufacturerDescriptor
.Header
.Length
);
945 ok( completeDvdManufacturerDescriptor
.Header
.Reserved
[0] == 0, "Reserved[0] is %x instead of 0\n", completeDvdManufacturerDescriptor
.Header
.Reserved
[0]);
946 ok( completeDvdManufacturerDescriptor
.Header
.Reserved
[1] == 0, "Reserved[1] is %x instead of 0\n", completeDvdManufacturerDescriptor
.Header
.Reserved
[1]);
948 SetLastError(0xdeadbeef);
950 /* Basic parameter check */
951 ret
= DeviceIoControl(handle
, IOCTL_DVD_READ_STRUCTURE
, &dvdReadStructure
, sizeof(DVD_READ_STRUCTURE
),
952 NULL
, sizeof(DVD_MANUFACTURER_DESCRIPTOR
), &nbBytes
, NULL
);
953 ok(!ret
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "IOCTL_DVD_READ_STRUCTURE should have failed %d %u\n", ret
, GetLastError());
956 static void test_cdrom_ioctl(void)
958 char drive_letter
, drive_path
[] = "A:\\", drive_full_path
[] = "\\\\.\\A:";
962 bitmask
= GetLogicalDrives();
965 trace("GetLogicalDrives failed : %u\n", GetLastError());
969 for(drive_letter
='A'; drive_letter
<='Z'; drive_letter
++)
971 if(!(bitmask
& (1 << (drive_letter
-'A') )))
974 drive_path
[0] = drive_letter
;
975 if(GetDriveTypeA(drive_path
) != DRIVE_CDROM
)
977 trace("Skipping %c:, not a CDROM drive.\n", drive_letter
);
981 trace("Testing with %c:\n", drive_letter
);
983 drive_full_path
[4] = drive_letter
;
984 handle
= CreateFileA(drive_full_path
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, 0, 0);
985 if(handle
== INVALID_HANDLE_VALUE
)
987 trace("Failed to open the device : %u\n", GetLastError());
991 /* Add your tests here */
992 test_dvd_read_structure(handle
);
1001 hdll
= GetModuleHandleA("kernel32.dll");
1002 pGetVolumeNameForVolumeMountPointA
= (void *) GetProcAddress(hdll
, "GetVolumeNameForVolumeMountPointA");
1003 pGetVolumeNameForVolumeMountPointW
= (void *) GetProcAddress(hdll
, "GetVolumeNameForVolumeMountPointW");
1004 pFindFirstVolumeA
= (void *) GetProcAddress(hdll
, "FindFirstVolumeA");
1005 pFindNextVolumeA
= (void *) GetProcAddress(hdll
, "FindNextVolumeA");
1006 pFindVolumeClose
= (void *) GetProcAddress(hdll
, "FindVolumeClose");
1007 pGetLogicalDriveStringsA
= (void *) GetProcAddress(hdll
, "GetLogicalDriveStringsA");
1008 pGetLogicalDriveStringsW
= (void *) GetProcAddress(hdll
, "GetLogicalDriveStringsW");
1009 pGetVolumeInformationA
= (void *) GetProcAddress(hdll
, "GetVolumeInformationA");
1010 pGetVolumePathNameA
= (void *) GetProcAddress(hdll
, "GetVolumePathNameA");
1011 pGetVolumePathNamesForVolumeNameA
= (void *) GetProcAddress(hdll
, "GetVolumePathNamesForVolumeNameA");
1012 pGetVolumePathNamesForVolumeNameW
= (void *) GetProcAddress(hdll
, "GetVolumePathNamesForVolumeNameW");
1014 test_query_dos_deviceA();
1015 test_define_dos_deviceA();
1016 test_FindFirstVolume();
1017 test_GetVolumePathNameA();
1018 test_GetVolumeNameForVolumeMountPointA();
1019 test_GetVolumeNameForVolumeMountPointW();
1020 test_GetLogicalDriveStringsA();
1021 test_GetLogicalDriveStringsW();
1022 test_GetVolumeInformationA();
1024 test_disk_extents();
1025 test_GetVolumePathNamesForVolumeNameA();
1026 test_GetVolumePathNamesForVolumeNameW();