Drive letter not available

broken image

if (d.DriveType != System.IO.DriveType.Fixed) DriveInfo d = new System.IO.DriveInfo(volume.DriveLetter) Public static bool IsVolumeMounted(string volumeLocation) MOUNT_LIST_STRUCT mount = new MOUNT_LIST_STRUCT() įor (int i = 0 i + System \s pid').Success) IntPtr _hdev = CreateFile('\\\\.\\TrueCrypt', FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero) īool bResult = DeviceIoControl(_hdev, TC_IOCTL_GET_MOUNTED_VOLUMES, buffer, size, buffer, size, out bytesReturned, IntPtr.Zero) IntPtr buffer = Marshal.AllocHGlobal((int)size) Uint size = (uint)Marshal.SizeOf(typeof(MOUNT_LIST_STRUCT)) Hope the following sample will help you find how to do in your case. In fact it's a 26 elements array (one for each possible drive letter), called wszVolume, which contain the path of the truecrypt volume which is mounted on. You will obtain a structure, with all of the mounted volumes path and drive letters. The idea is to call the DeviceIoControl function, asking for the TC_IOCTL_GET_MOUNTED_VOLUMES In fact, that's exactly what the TrueCrypt GUI is doing.

broken image
broken image

This could be achieved with the DeviceIoControl function.

broken image

A way to do that would be to directly ask to Truecrypt driver himself.