msi: Add Polish translation.
[wine] / dlls / kernel32 / tests / volume.c
1 /*
2  * Unit test suite
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 "wine/test.h"
22 #include "winbase.h"
23
24 #define CDROM   "CDROM"
25 #define FLOPPY  "FLOPPY"
26 #define HARDISK "HARDDISK"
27 #define LANMAN  "LANMANREDIRECTOR"
28 #define RAMDISK "RAMDISK"
29
30 static void test_query_dos_deviceA(void)
31 {
32     char drivestr[] = "a:";
33     char *p, buffer[2000];
34     DWORD ret;
35     for (;drivestr[0] <= 'z'; drivestr[0]++) {
36         ret = QueryDosDeviceA( drivestr, buffer, sizeof(buffer));
37         if(ret) {
38             for (p = buffer; *p; p++) *p = toupper(*p);
39             todo_wine
40             ok( strstr( buffer, CDROM)   || strstr( buffer, FLOPPY) ||
41                 strstr( buffer, HARDISK) || strstr( buffer, LANMAN) ||
42                 strstr( buffer, RAMDISK), "expect the string %s contains %s,%s,%s,%s or %s\n",
43                 buffer, CDROM, FLOPPY, HARDISK, LANMAN, RAMDISK);
44         }
45     }
46 }
47
48 static void test_GetVolumeNameForVolumeMountPointA(void)
49 {
50     BOOL ret;
51     char volume[MAX_PATH], path[] = "c:\\";
52     DWORD len = sizeof(volume);
53
54     ret = GetVolumeNameForVolumeMountPointA(path, volume, 0);
55     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
56
57     if (0) { /* these crash on XP */
58     ret = GetVolumeNameForVolumeMountPointA(path, NULL, len);
59     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
60
61     ret = GetVolumeNameForVolumeMountPointA(NULL, volume, len);
62     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
63     }
64
65     ret = GetVolumeNameForVolumeMountPointA(path, volume, len);
66     ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
67 }
68
69 static void test_GetVolumeNameForVolumeMountPointW(void)
70 {
71     BOOL ret;
72     WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0};
73     DWORD len = sizeof(volume) / sizeof(WCHAR);
74
75     ret = GetVolumeNameForVolumeMountPointW(path, volume, 0);
76     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
77
78     if (0) { /* these crash on XP */
79     ret = GetVolumeNameForVolumeMountPointW(path, NULL, len);
80     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
81
82     ret = GetVolumeNameForVolumeMountPointW(NULL, volume, len);
83     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
84     }
85
86     ret = GetVolumeNameForVolumeMountPointW(path, volume, len);
87     ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n");
88 }
89
90 START_TEST(volume)
91 {
92     test_query_dos_deviceA();
93     test_GetVolumeNameForVolumeMountPointA();
94     test_GetVolumeNameForVolumeMountPointW();
95 }