获取磁盘/集群号上的文件偏移量

我需要得到有关文件位于NTFS磁盘上的位置的任何信息。 绝对偏移,群集ID ..什么的。 我需要扫描磁盘两次,一次获得分配的文件,一次我需要直接在RAW模式下打开分区,并尝试find其余的数据(从删除的文件)。 我需要一种方法来理解,我发现的数据和我之前作为文件处理过的数据是一样的。 当我在原始模式下扫描磁盘时,我发现的数据的偏移量可以以某种方式转换为文件的偏移量(具有关于磁盘几何的信息)。 有没有办法做到这一点? 其他解决scheme也被接受。 现在我正在玩FSCTL_GET_NTFS_FILE_RECORD,但目前无法使其正常工作,我不确定这会有帮助。

UPDATE

我发现下面的函数http://msdn.microsoft.com/en-us/library/windows/desktop/aa364952(v=vs.85).aspx它返回包含nFileIndexHigh和nFileIndexLowvariables的结构。 文档说

The identifier that is stored in the nFileIndexHigh and nFileIndexLow members is called the file ID. Support for file IDs is file system-specific. File IDs are not guaranteed to be unique over time, because file systems are free to reuse them. In some cases, the file ID for a file can change over time.

我真的不明白这是什么 我无法将其连接到文件的物理位置。 稍后有可能从MFT中提取此文件ID吗?

UPDATE

发现这个: This identifier and the volume serial number uniquely identify a file. This number can change when the system is restarted or when the file is opened. This identifier and the volume serial number uniquely identify a file. This number can change when the system is restarted or when the file is opened.

这不能满足我的要求,因为我要打开文件,ID可能改变的事实并不会让我开心。

有任何想法吗?

使用碎片整理IOCTL 。 例如, FSCTL_GET_RETRIEVAL_POINTERS会告诉你包含文件数据的盘区。