Converting a path to its GUID form
1 answer
You need P / Invoke GetVolumeNameForVolumeMountPoint
:
static string GetVolumeGuidPath(string mountPoint)
{
StringBuilder sb = new StringBuilder(50);
GetVolumeNameForVolumeMountPoint(mountPoint, sb, 50);
return sb.ToString();
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool GetVolumeNameForVolumeMountPoint(
string lpszVolumeMountPoint,
[Out] StringBuilder lpszVolumeName,
int cchBufferLength);
+7
source to share