Commit 7d4bbe9e authored by Guy Albertelli's avatar Guy Albertelli Committed by Alexandre Julliard

kernel32/tests: Add more tests for GetVolumeNameForVolumeMountPointA.

parent cbf4671d
...@@ -114,7 +114,8 @@ static void test_GetVolumeNameForVolumeMountPointA(void) ...@@ -114,7 +114,8 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
{ {
BOOL ret; BOOL ret;
char volume[MAX_PATH], path[] = "c:\\"; char volume[MAX_PATH], path[] = "c:\\";
DWORD len = sizeof(volume); DWORD len = sizeof(volume), reti;
char temp_path[MAX_PATH];
/* not present before w2k */ /* not present before w2k */
if (!pGetVolumeNameForVolumeMountPointA) { if (!pGetVolumeNameForVolumeMountPointA) {
...@@ -122,6 +123,10 @@ static void test_GetVolumeNameForVolumeMountPointA(void) ...@@ -122,6 +123,10 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
return; return;
} }
reti = GetTempPathA(MAX_PATH, temp_path);
ok(reti != 0, "GetTempPathA error %d\n", GetLastError());
ok(reti < MAX_PATH, "temp path should fit into MAX_PATH\n");
ret = pGetVolumeNameForVolumeMountPointA(path, volume, 0); ret = pGetVolumeNameForVolumeMountPointA(path, volume, 0);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n"); ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
...@@ -135,6 +140,47 @@ static void test_GetVolumeNameForVolumeMountPointA(void) ...@@ -135,6 +140,47 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len); ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n"); ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
ok(!strncmp( volume, "\\\\?\\Volume{", 11),
"GetVolumeNameForVolumeMountPointA failed to return valid string <%s>\n",
volume);
/* test with too small buffer */
ret = pGetVolumeNameForVolumeMountPointA(path, volume, 10);
todo_wine
ok(ret == FALSE && GetLastError() == ERROR_FILENAME_EXCED_RANGE,
"GetVolumeNameForVolumeMountPointA failed, wrong error returned, was %d, should be ERROR_FILENAME_EXCED_RANGE\n",
GetLastError());
/* Try on a arbitrary directory */
ret = pGetVolumeNameForVolumeMountPointA(temp_path, volume, len);
todo_wine
ok(ret == FALSE && GetLastError() == ERROR_NOT_A_REPARSE_POINT,
"GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
temp_path, GetLastError());
/* Try on a non-existent dos drive */
path[2] = 0;
for (;path[0] <= 'z'; path[0]++) {
ret = QueryDosDeviceA( path, volume, len);
if(!ret) break;
}
if (path[0] <= 'z')
{
path[2] = '\\';
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
todo_wine
ok(ret == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND,
"GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
path, GetLastError());
/* Try without trailing \ and on a non-existent dos drive */
path[2] = 0;
ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
todo_wine
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
path, GetLastError());
}
} }
static void test_GetVolumeNameForVolumeMountPointW(void) static void test_GetVolumeNameForVolumeMountPointW(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment