How to get the total sectors of physical disk
-
The USB flash disk have no CHS parameters (the system use virtual parameters),I only need to get teh total sectors for physical drive. The MBR and BOOT may be failure. so your function is invalid. ,how to do it? Thanks.
Hi, Could you please elaborate the question? Are you looking for the Sector information of the Physical drives i.e Hard disk or USB disk??
-
Hi, Could you please elaborate the question? Are you looking for the Sector information of the Physical drives i.e Hard disk or USB disk??
-
I want to get the disk size for every physical disk. The CHS parameter is true for harddisk,but wrong for USB flash disk. Becase the system assume that's X*255*63,the total sectors are also wrong. I dont know what function can I use.
Hi As per my knowledge, You can open any disk (using CreateFile(DriveName,....)and after reading the first sector of the disk you will get Boot record of the same from there I feel you can get the size of the disk Otherwise harddisk has Master boot table from where you can get the partitions and their sizes.If you want to open a physical drive you can open it using the CreateFile("\\\\.\\PHYSICALDRIVE0",....) for the harddisk.and after reading the MBT you can get the drive information .If you want to use the WINDOWS api then you can use GetDiskFreeSpace() API and pass NULL as a root directory it will return you the TOTAL number of clusters,multiply it with the Sectores per cluster and bytes per sector.You will get the disk size.