Link to home
Start Free TrialLog in
Avatar of crward
crward

asked on

Low level disk i/o in C++ for editing the metafiles

I currently own two Maxtor hard drives--both of which I've experienced at one time or another a failure or corruption of the master file table (\$MFT).  As a result of this I frequently have backed up the drives metafiles using R-Studio NTFS, but have no way to restore the backed up files without typing in each byte from the backed up file.  Frustrated by this, I decided to design a C++ program that would both read and write these metafiles, however I do not know how to do low-level disk I/O in C++ under Windows 2000.  Can anyone point me in the right direction to how I might do low-level disk reads and writes in a Windows 2000 C++ environment so that I can save and restore my drives metafiles?

Thanks,

Chris
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

I guess Windows2000 won't allow you to write directly to any sector of your disk. So the unique solution I know is to build a driver to access IDE I/O port, just like in DOS.
Look at this question related to writting directly to system I/O ports.
https://www.experts-exchange.com/questions/21045309/Controll-of-PC-speaker-on-windows-XP-embedde-system.html
Avatar of Axter
Look at DeviceIoControl API function
ASKER CERTIFIED SOLUTION
Avatar of Axter
Axter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of grg99
grg99

You can open up any disk device with some funny drive name incantation, see the drive paths that scroll up your screen when you do a "safe mode" boot.   Put those in a call to CreateFile() and you shoul dbe good to go.