问题
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)?
回答1:
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.
回答2:
Examining FAT boot sector: Extract Floppy Disk Geometry from the Boot Sector
FAT Root Directory Structure on Floppy Disk and File Information
Long File Name (LFN) Entries in the FAT Root Directory of Floppy Disks in win32.
来源:https://stackoverflow.com/questions/4223246/how-can-i-access-the-file-system-and-sector-of-a-hard-disk-drive-by-c