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

泄露秘密 提交于 2019-12-25 06:46:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!