[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "GetVolumeNameForVolumeMountPointW")]
static extern bool GetVolumeNameForVolumeMountPoint(string
lpszVolumeMountPoint, [Out] StringBuilder lpszVolumeName,
uint cchBufferLength);
None.
None.
Please add some!
public static string GetVolumeName(string MountPoint)
{
const int MaxVolumeNameLength = 100;
StringBuilder sb = new StringBuilder(MaxVolumeNameLength);
if (!GetVolumeNameForVolumeMountPoint(MountPoint, sb, (uint) MaxVolumeNameLength))
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
return sb.ToString();
}
Do you know one? Please contribute it!