Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine Disk Geometry on Windows

I need to programmatically determine out how many sectors, heads, and cylinders are on a physical disk from Windows XP. Does anyone know the API for determining this? Where might Windows expose this information?

like image 630
Terry Avatar asked Sep 08 '08 21:09

Terry


1 Answers

Use DeviceIoControl with control code IOCTL_DISK_GET_DRIVE_GEOMETRY or IOCTL_DISK_GET_DRIVE_GEOMETRY_EX.

There's sample code in MSDN to do this here.

like image 51
ChrisN Avatar answered Sep 30 '22 15:09

ChrisN