mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 05:00:30 +00:00
118 lines
4.0 KiB
C
118 lines
4.0 KiB
C
/*
|
|
* Unit test suite
|
|
*
|
|
* Copyright 2006 Stefan Leichter
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#include "wine/test.h"
|
|
#include "winbase.h"
|
|
|
|
#define CDROM "CDROM"
|
|
#define FLOPPY "FLOPPY"
|
|
#define HARDISK "HARDDISK"
|
|
#define LANMAN "LANMANREDIRECTOR"
|
|
#define RAMDISK "RAMDISK"
|
|
|
|
static HINSTANCE hdll;
|
|
static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointA)(LPCSTR, LPSTR, DWORD);
|
|
static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD);
|
|
|
|
/* ############################### */
|
|
|
|
static void test_query_dos_deviceA(void)
|
|
{
|
|
char drivestr[] = "a:";
|
|
char *p, buffer[2000];
|
|
DWORD ret;
|
|
for (;drivestr[0] <= 'z'; drivestr[0]++) {
|
|
ret = QueryDosDeviceA( drivestr, buffer, sizeof(buffer));
|
|
if(ret) {
|
|
for (p = buffer; *p; p++) *p = toupper(*p);
|
|
todo_wine
|
|
ok( strstr( buffer, CDROM) || strstr( buffer, FLOPPY) ||
|
|
strstr( buffer, HARDISK) || strstr( buffer, LANMAN) ||
|
|
strstr( buffer, RAMDISK), "expect the string %s contains %s,%s,%s,%s or %s\n",
|
|
buffer, CDROM, FLOPPY, HARDISK, LANMAN, RAMDISK);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void test_GetVolumeNameForVolumeMountPointA(void)
|
|
{
|
|
BOOL ret;
|
|
char volume[MAX_PATH], path[] = "c:\\";
|
|
DWORD len = sizeof(volume);
|
|
|
|
/* not present before w2k */
|
|
if (!pGetVolumeNameForVolumeMountPointA) {
|
|
skip("GetVolumeNameForVolumeMountPointA not found\n");
|
|
return;
|
|
}
|
|
|
|
ret = pGetVolumeNameForVolumeMountPointA(path, volume, 0);
|
|
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
|
|
|
|
if (0) { /* these crash on XP */
|
|
ret = pGetVolumeNameForVolumeMountPointA(path, NULL, len);
|
|
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
|
|
|
|
ret = pGetVolumeNameForVolumeMountPointA(NULL, volume, len);
|
|
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
|
|
}
|
|
|
|
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
|
|
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
|
|
}
|
|
|
|
static void test_GetVolumeNameForVolumeMountPointW(void)
|
|
{
|
|
BOOL ret;
|
|
WCHAR volume[MAX_PATH], path[] = {'c',':','\\',0};
|
|
DWORD len = sizeof(volume) / sizeof(WCHAR);
|
|
|
|
/* not present before w2k */
|
|
if (!pGetVolumeNameForVolumeMountPointW) {
|
|
skip("GetVolumeNameForVolumeMountPointW not found\n");
|
|
return;
|
|
}
|
|
|
|
ret = pGetVolumeNameForVolumeMountPointW(path, volume, 0);
|
|
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
|
|
|
|
if (0) { /* these crash on XP */
|
|
ret = pGetVolumeNameForVolumeMountPointW(path, NULL, len);
|
|
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
|
|
|
|
ret = pGetVolumeNameForVolumeMountPointW(NULL, volume, len);
|
|
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
|
|
}
|
|
|
|
ret = pGetVolumeNameForVolumeMountPointW(path, volume, len);
|
|
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n");
|
|
}
|
|
|
|
START_TEST(volume)
|
|
{
|
|
hdll = GetModuleHandleA("kernel32.dll");
|
|
pGetVolumeNameForVolumeMountPointA = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointA");
|
|
pGetVolumeNameForVolumeMountPointW = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointW");
|
|
|
|
test_query_dos_deviceA();
|
|
test_GetVolumeNameForVolumeMountPointA();
|
|
test_GetVolumeNameForVolumeMountPointW();
|
|
}
|