Commit 7918c59f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

kernel32: Add a stub implementation for GetVolumeNameForVolumeMountPoint{A, W}.

parent a7c99707
......@@ -649,8 +649,8 @@
@ stdcall GetVersionExW(ptr)
@ stdcall GetVolumeInformationA(str ptr long ptr ptr ptr ptr long)
@ stdcall GetVolumeInformationW(wstr ptr long ptr ptr ptr ptr long)
@ stub GetVolumeNameForVolumeMountPointA
@ stdcall GetVolumeNameForVolumeMountPointW(wstr long long)
@ stdcall GetVolumeNameForVolumeMountPointA(str ptr long)
@ stdcall GetVolumeNameForVolumeMountPointW(wstr ptr long)
@ stdcall GetVolumePathNameA(str ptr long)
@ stdcall GetVolumePathNameW(wstr ptr long)
# @ stub GetVolumePathNamesForVolumeNameA
......
......@@ -45,7 +45,51 @@ static void test_query_dos_deviceA(void)
}
}
static void test_GetVolumeNameForVolumeMountPointA(void)
{
BOOL ret;
char volume[MAX_PATH], path[] = "c:\\";
DWORD len = sizeof(volume);
ret = GetVolumeNameForVolumeMountPointA(path, volume, 0);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
if (0) { /* these crash on XP */
ret = GetVolumeNameForVolumeMountPointA(path, NULL, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
ret = GetVolumeNameForVolumeMountPointA(NULL, volume, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
}
ret = GetVolumeNameForVolumeMountPointA(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);
ret = GetVolumeNameForVolumeMountPointW(path, volume, 0);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
if (0) { /* these crash on XP */
ret = GetVolumeNameForVolumeMountPointW(path, NULL, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
ret = GetVolumeNameForVolumeMountPointW(NULL, volume, len);
ok(ret == FALSE, "GetVolumeNameForVolumeMountPointW succeeded\n");
}
ret = GetVolumeNameForVolumeMountPointW(path, volume, len);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointW failed\n");
}
START_TEST(volume)
{
test_query_dos_deviceA();
test_GetVolumeNameForVolumeMountPointA();
test_GetVolumeNameForVolumeMountPointW();
}
......@@ -748,14 +748,47 @@ BOOL WINAPI SetVolumeLabelA(LPCSTR root, LPCSTR volname)
/***********************************************************************
* GetVolumeNameForVolumeMountPointW (KERNEL32.@)
* GetVolumeNameForVolumeMountPointA (KERNEL32.@)
*/
BOOL WINAPI GetVolumeNameForVolumeMountPointW(LPCWSTR str, LPWSTR dst, DWORD size)
BOOL WINAPI GetVolumeNameForVolumeMountPointA( LPCSTR path, LPSTR volume, DWORD size )
{
FIXME("(%s, %p, %x): stub\n", debugstr_w(str), dst, size);
return 0;
BOOL ret;
WCHAR volumeW[50], *pathW = NULL;
DWORD len = min( sizeof(volumeW) / sizeof(WCHAR), size );
TRACE("(%s, %p, %x)\n", debugstr_a(path), volume, size);
if (!path || !(pathW = FILE_name_AtoW( path, TRUE )))
return FALSE;
if ((ret = GetVolumeNameForVolumeMountPointW( pathW, volumeW, len )))
FILE_name_WtoA( volumeW, -1, volume, len );
HeapFree( GetProcessHeap(), 0, pathW );
return ret;
}
/***********************************************************************
* GetVolumeNameForVolumeMountPointW (KERNEL32.@)
*/
BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWORD size )
{
BOOL ret = FALSE;
static const WCHAR fmt[] =
{ '\\','\\','?','\\','V','o','l','u','m','e','{','%','0','2','x','}','\\',0 };
TRACE("(%s, %p, %x)\n", debugstr_w(path), volume, size);
if (!path || !path[0]) return FALSE;
if (size >= sizeof(fmt) / sizeof(WCHAR))
{
/* FIXME: will break when we support volume mounts */
sprintfW( volume, fmt, tolowerW( path[0] ) - 'a' );
ret = TRUE;
}
return ret;
}
/***********************************************************************
* DefineDosDeviceW (KERNEL32.@)
......
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