Redetect disk after IOCTL_ATA_PASS_THROUGH with 'SET MAX' or 'SET MAX ADDRESS EXT'

Hi,

We are currently prototyping a security tool that builds functionality on the ATA “Host Protected Area” feature. The prototype code changes the visible disk size using IOCTL_ATA_PASS_THROUGH and either the ‘SET MAX’ or ‘SET MAX ADDRESS EXT’ command as appropriate. This works great.

However, after the size change Windows does not notice (not unexpected) and will fail very ungracefully if a file system is on the disk. We tried working around this using a mixture of IOCTL_DISK_UPDATE_DRIVE_SIZE and IOCTL_DISK_UPDATE_PROPERTIES but neither works in this case.

The only solution we have is to bruteforce Windows to remove the disk device and then re-enumerate using CM_Reenumerate_DevNode_Ex (based upon the famous ‘Devcon’ sample).

Please does anyone know a more elegant method to force detect after the size change?

Best wishes

Jim