NTFS如何区分文件夹和文件

发布于 2024-11-05 20:04:55 字数 120 浏览 0 评论 0原文

我知道如果 1 存在于属性的二进制表示的第四个位置,那么这是一个目录,但我不确定 1 是否不存在于该位置,我是否应该将其视为文件?

或者是否存在任何其他属性来确定文件夹或文件? 请帮我。

谢谢。

i know that if 1 is present at the 4th position of binary representation of attribute then this is a directory, but i am not sure if 1 is not present at that location should i consider it as a file?

or is there any other attribute present to determine folder or file ?
please help me.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧城空念 2024-11-12 20:04:55

每个文件在卷的主文件表 (MFT) 中都有一个文件记录。

您可以检查存储在 0x16 和 0x17 处的 2 字节标志(注意,小尾数)。第二位(从右数)告诉它是文件夹(1)还是文件(0)。

if (flag & 0x02)
    it's a folder
else
    it's a file

如果您将最初代表文件的该位强制更改为 1(例如在 WinHex 的帮助下),并且(可能需要重新启动或需要刷新系统缓存)双击它,操作系统将报告文件已损坏。

另外,第一位表明它是否被删除。

if (flag & 0x01)
    it's a normal file or folder not deleted
else
    it's a deleted file or folder

Every file has a File Record in Master File Table (MFT) of the volume.

You can check the 2-byte flag stored at 0x16 and 0x17(attention, little endian). The second bit (counting from right) tells whether it's a folder(1), or a file(0).

if (flag & 0x02)
    it's a folder
else
    it's a file

If you change this bit that would originally represent a file to 1 by force, for example with the help of WinHex, and (probably a restart or system cache fresh is needed) double click it, OS would report that the file is corrupted.

In addition, the first bit tells if it is deleted.

if (flag & 0x01)
    it's a normal file or folder not deleted
else
    it's a deleted file or folder
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文