转储 $mft 文件的内容
对于我正在做的一些商业项目,我需要能够读取 $mft 文件中存储的实际数据。
我找到了一个可以提供帮助的 gpl lib ,但由于它的 gpl我无法将它集成到我的代码中。
有人可以向我指出一个我可以使用的项目/或者向我指出相关的Windows API(不需要1000行代码来实现的东西)
顺便说一句,为什么Windows不允许我读取mft文件无论如何直接? (通过创建文件和读取方法,如果我想毁掉我的驱动器,那是我的事而不是女士的事)。
谢谢。
for some commercial project I'm doing I need to be able to read the actual data stored on the $mft file.
I found a gpl lib that could help, but since its gpl i can't integrate it into my code.
could someone please point me to a project that i could use / or point me at the relevant windows API (something that doesn't require 1000 lines of code to implement)
BTW, why doesn't windows simply allow me to read the mft file directly anyway? (through the create file and the read method, if i want to ruin my drive it's my business not Ms's).
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需在 \.\X 上使用 CreateFile() 打开卷的句柄:其中 X 是驱动器号(请查看有关 CreateFile() 的 MSDN 文档,它在“备注”部分提到了这一点)。
将第一个扇区读入 NTFS 引导记录结构(您可以在线找到它,搜索 Richard“Flatcap”Russon,编辑:我找到了它,http://www.flatcap.org/ntfs/ntfs/files/boot.html )。引导扇区结构中的字段之一给出了簇中 MFT 的起始位置($MFT 的 VCN 0 的 LCN),您必须对该位置执行 SetFilePointer() 读取扇区的倍数。该位置的前 1024 个字节是 $MFT 的文件记录,您可以再次解析此结构以查找始终非常驻的数据属性,其大小是当时 MFT 文件的实际大小。
$Boot、文件记录和基本属性(标准信息、文件名和数据)的基本结构以及解析代码应该运行少于 1000 行代码。
You just have to open a handle to the volume using CreateFile() on \.\X: where X is the drive letter (check the MSDN documentation on CreateFile(), it mentions this in the Remarks section).
Read the first sector into a NTFS Boot Record structure (you can find it online, search for Richard "Flatcap" Russon, edit: I found it, http://www.flatcap.org/ntfs/ntfs/files/boot.html ). One of the fields in the boot sector structure gives the start location of the MFT in clusters (LCN of VCN 0 of the $MFT), you have to do a SetFilePointer() to that location an read in multiples of sectors. The first 1024 bytes from that location is the file record of the $MFT, again you can parse this structure to find the data attribute which is always non-resident and it's size is the actual size of the MFT file at that time.
The basic structures for $Boot, File Record and basic attributes (Standard Information, File Name and Data) along with the parsing code should run you less than 1000 lines of code.
这不是一个微不足道的提议。您可能必须推出自己的代码解决方案才能完成此任务。您可以通过查看 http://www.ntfs 获取有关 $MFT 详细信息的一些信息。 com/ntfs-mft.htm
另一种选择是花一些时间查看开源项目 NTFS-3g 的源代码。您可以从 http://www.tuxera.com/community/ntfs- 下载源代码3g-download/
另一个好的项目是 NTFSProgs http://en.wikipedia.org/wiki /Ntfsprogs
祝你好运。
This is not going to be a trivial proposition. You'll likely have to roll your own code solution to accomplish this. You can get some info about the details of the $MFT by checking out http://www.ntfs.com/ntfs-mft.htm
Another option is to spend some time looking through the source code to the opensource project NTFS-3g. You can download the source from http://www.tuxera.com/community/ntfs-3g-download/
Another good project is the NTFSProgs http://en.wikipedia.org/wiki/Ntfsprogs
Good luck.