toktam
toktam

Reputation: 11

How can I access the file system and sector of a hard disk drive by C++?

How can I read a sector of a hard disk drive, access the file system and block or cluster of a file, list of bad blocks (FAT) or cluster file (NTFS)? Or access the list of free blocks (FAT) or cluster bitmap (NTFS)?

Upvotes: 1

Views: 2340

Answers (2)

Martin B
Martin B

Reputation: 24180

You can use the CreateFile API to open a physical disk by specifying a special file name (e.g. "\\.\PhysicalDrive0") -- see the section "Physical Disks and Volumes" in the CreateFile MSDN documentation.

Be very careful though, especially with write operations -- you can easily trash your entire system this way.

Upvotes: 3

Related Questions