How to get disk/drive size
-
How to get hard disk size, partition size and partition start position in disk through windows API or using win ioctl code I tried to use SetFilePointerEx on winxp but got compile error(unrecognized function)
-
How to get hard disk size, partition size and partition start position in disk through windows API or using win ioctl code I tried to use SetFilePointerEx on winxp but got compile error(unrecognized function)
Try using GetDiskFreeSpace Function which will accept driveletter as in parameter. It return's number of clusters available and all you need . Here see in msdn : http://msdn.microsoft.com/en-us/library/aa364935(VS.85).aspx[^] And you can get the drives available through GetLogicalDrives() API. Kushagra
-
I think you may need the IOCTL_STORAGE_READ_CAPACITY[^] device IO control request.
MVP 2010 - are they mad?
As suggested above DeviceIOControl is needed. In addition to that if you want to get the partition size and partition start position you have to call IOCTL_DISK_GET_DRIVE_LAYOUT_EX([^]) as device control code then you will get the partition data. It has structure DRIVE_LAYOUT_INFORMATION_EX([^]), which will give the required data.
Величие не Бога может быть недооценена.
modified on Thursday, February 4, 2010 1:33 AM
-
Try using GetDiskFreeSpace Function which will accept driveletter as in parameter. It return's number of clusters available and all you need . Here see in msdn : http://msdn.microsoft.com/en-us/library/aa364935(VS.85).aspx[^] And you can get the drives available through GetLogicalDrives() API. Kushagra
-
As suggested above DeviceIOControl is needed. In addition to that if you want to get the partition size and partition start position you have to call IOCTL_DISK_GET_DRIVE_LAYOUT_EX([^]) as device control code then you will get the partition data. It has structure DRIVE_LAYOUT_INFORMATION_EX([^]), which will give the required data.
Величие не Бога может быть недооценена.
modified on Thursday, February 4, 2010 1:33 AM
-
Thanks IOCTL_DISK_GET_DRIVE_LAYOUT gives geometry of partition (size, starting offset in disk, type etc). How to get disk(PHYSICALDRIVE0,1..) size.