Author Topic: Any way to detect HPA or DCO on disks in Windows?  (Read 3513 times)


  • Hero Member
  • *****
  • Posts: 714
Any way to detect HPA or DCO on disks in Windows?
« on: October 13, 2015, 04:31:45 pm »
I've created a program that looks at disks.

I'd like it to be able to detect HPA (Host Protected Area) and DCO's (Device Configuration Overlay) when disks that have either of those is examined. I can and have coded the solution for my Linux version simply by calling hdparm and the -N switch (as also discussed here: However, to my knowledge, Windows has no such native abilities without third party drivers and so on. And all the Windows tools I know of that can do this use some kind of special DLL, presumebly propriatory and not free (as in free beer).

And so my question is whether there is in fact a way that I might be missing, perhaps using part of the Windows API or whatever, to detect HPA\DCO using Freepascal?

Lazarus 2.0.4 and fpc 3.0.4 - Linux Mint 19 LTS, Windows 10 64 and Mac OSX Catlina
Useful Page to remember :


  • Hero Member
  • *****
  • Posts: 2268
  • Compiler Developer
Re: Any way to detect HPA or DCO on disks in Windows?
« Reply #1 on: November 13, 2015, 03:29:13 pm »
You should take a look at DeviceIOControl and IOCTL_ATA_PASS_THROUGH. This way you can directly pass ATA commands to the drive (you should of course read the ATA specification for this). It would be best to ensure though that the device is offline (IOCTL_VOLUME_OFFLINE) when playing around with HPA/DCO and bring it online afterwards again (IOCTL_VOLUME_ONLINE). Please note that this doesn't work with the system drive, but you shouldn't play around with HPA/DCO on the system drive while it's running anyway.



TinyPortal © 2005-2018