Mickey Marshall

Mickey Marshall

  • NA
  • 730
  • 202k

get a handle to various storage media with CreateFile

Feb 28 2015 11:15 AM

I'm trying to read all partition info on  all drives:
        NoRootDirectory = 1,
        Removable = 2,
        Fixed = 3,
        Network = 4,
        CDRom = 5,
        Ram = 6,
currently I can open and read the hard drive partitions using:
DeviceName = String.Format("\\\\?\\GLOBALROOT\\Device\\Harddisk%(0)\\Partition{1)", 0, 1);
Handle = CreateFile(DeviceName, 0, FileShare.Read, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);// FileAttributes.Normal, IntPtr.Zero);

where c:=0
and
1=is the first partition on c:
Then I use DeviceIoControl to read the partition and volume information

what would the names be for the other drive types?

Thanks
MickeyM