Listing available partitions
List all available drive partitions with their volumes, parameteres
(most important size to caluculate partition sector count)
This must be windows application.
PartitionSectorCount = PartitionSize / 512;
I used DeviceIoControl(...) API function width
IOCTL_DISK_GET_DRIVE_LAYOUT parameter to list
all available partitions on specified disk.
It works but there is one problem.
It returns all partitions by their numbers, there is no
information about drive letter.
How can I idenitfy partition drive letter?
key to open it with CreateFile(...) function
to have direct access to that portion of drive.
There is another solution.
is to
1. open direct access to all portions of drive
2. read MBR (master boot record) which contains main information
about partitions.
I don't like this solution because it's dangerous.
Error in my application may destroy operating system, file system on other partitions...
That's why I preffer to have full access only to some portion of
drive only to one partition to prevent any damage.
Task:
List all available drive partitions with their volumes, parameteres
(most important size to caluculate partition sector count)
This must be windows application.
PartitionSectorCount = PartitionSize / 512;
I used DeviceIoControl(...) API function width
IOCTL_DISK_GET_DRIVE_LAYOUT parameter to list
all available partitions on specified disk.
It works but there is one problem.
It returns all partitions by their numbers, there is no
information about drive letter.
How can I idenitfy partition drive letter?
So.
* The 1st variant:
There is no problem, if you'll get access to this drive by the number of this drive. ;-) E.g., if you want to read file 'text.txt' from drive D:\, MY_DOC directory:
D:\MY_DOC\text.txt
you should set the current drive by API/INT 13h (if DOS) by drive number and then change directory to MY_DOC. Or set drive by number and then simply read this file by path MY_DOC\text.txt.
* The 2nd variant:
Get information, which kind of letters are available on your machine. Then create array to correlate drive letters to drive number. It is simply, because numbers of disk drives go consistently. So, if letters are C,D,X,Z, their drive numbers are 3,4,5,6 accordingly. But if letters are A,C,D,X, drive numbelrs will be 1,3,4,5 (disk B excepted).
Sorry for poor english. :)
If you want to know, which kind of letter is available on your machine, you should:
Sorry for late answer.
how can I get access volume by it's number in windows ?
how ?
I think you are wrong,
in Windows NT it's not always as you think.