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"
24 static HINSTANCE hdll;
25 static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointA)(LPCSTR, LPSTR, DWORD);
26 static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD);
28 /* ############################### */
30 static void test_query_dos_deviceA(void)
32 char drivestr[] = "a:";
33 char *p, buffer[2000];
37 for (;drivestr[0] <= 'z'; drivestr[0]++) {
38 ret = QueryDosDeviceA( drivestr, buffer, sizeof(buffer));
40 for (p = buffer; *p; p++) *p = toupper(*p);
41 if (strstr(buffer, "HARDDISK") || strstr(buffer, "RAMDISK")) found = TRUE;
44 todo_wine ok(found, "expected at least one devicename to contain HARDDISK or RAMDISK\n");
47 static void test_GetVolumeNameForVolumeMountPointA(void)
50 char volume[MAX_PATH], path[] = "c:\\";
51 DWORD len = sizeof(volume);
53 /* not present before w2k */
54 if (!pGetVolumeNameForVolumeMountPointA) {
55 skip("GetVolumeNameForVolumeMountPointA not found\n");
59 ret = pGetVolumeNameForVolumeMountPointA(path, volume, 0);
60 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
62 if (0) { /* these crash on XP */
63 ret = pGetVolumeNameForVolumeMountPointA(path, NULL, len);
64 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
66 ret = pGetVolumeNameForVolumeMountPointA(NULL, volume, len);
67 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
70 ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
71 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
74 static void test_GetVolumeNameForVolumeMountPointW(void)
77 WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0};
78 DWORD len = sizeof(volume) / sizeof(WCHAR);
80 /* not present before w2k */
81 if (!pGetVolumeNameForVolumeMountPointW) {
82 skip("GetVolumeNameForVolumeMountPointW not found\n");
86 ret = pGetVolumeNameForVolumeMountPointW(path, volume, 0);
87 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
89 if (0) { /* these crash on XP */
90 ret = pGetVolumeNameForVolumeMountPointW(path, NULL, len);
91 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
93 ret = pGetVolumeNameForVolumeMountPointW(NULL, volume, len);
94 ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
97 ret = pGetVolumeNameForVolumeMountPointW(path, volume, len);
98 ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n");
103 hdll = GetModuleHandleA("kernel32.dll");
104 pGetVolumeNameForVolumeMountPointA = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointA");
105 pGetVolumeNameForVolumeMountPointW = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointW");
107 test_query_dos_deviceA();
108 test_GetVolumeNameForVolumeMountPointA();
109 test_GetVolumeNameForVolumeMountPointW();