using WIN API CreateFile to get a handle for all storage devices
-
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
MRM
-
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
MRM
-
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
MRM
But you probably should just use boost::filesystem. Its what the filesystem TS is based off of. :cool:
-
But you probably should just use boost::filesystem. Its what the filesystem TS is based off of. :cool:
I am using managed code (c#). Can you tell me what "boost::filesystem" would be in c#? Thanks
MRM
-
I read this and it was extremely helpful. I can use things like: \\?\PhysicalDrive0 \\?\CDRom0 to get the number of partitions on the devices I can use: \\?\GLOBALROOT\Device\Harddisk0\Partition0 \\?\GLOBALROOT\Device\CDRom0\Partition0 to get handles to the various partitions on fixed and removable drives but not on cdroms Any suggestions on how to get partition info for cd drives? Thanks
MRM