如何通过C ++访问硬盘驱动器的文件系统和扇区? [英] How can I access the file system and sector of a hard disk drive by C++?

查看:115
本文介绍了如何通过C ++访问硬盘驱动器的文件系统和扇区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何读取硬盘驱动器的扇区,访问文件系统和文件的块或群集,坏块(FAT)或群集文件(NTFS)的列表?还是访问可用块(FAT)或群集位图(NTFS)的列表?

解决方案

您可以使用CreateFile API通过指定特殊文件名(例如"\\.\PhysicalDrive0")来打开物理磁盘-请参阅物理磁盘和卷"部分在 CreateFile MSDN文档中.

但是要特别小心,尤其是在进行写操作时,您很容易以此方式破坏整个系统.

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)?

解决方案

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.

这篇关于如何通过C ++访问硬盘驱动器的文件系统和扇区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆