2

在 Windows 上,一些二进制文件例如.obj是 COFF 格式,而其他.exe二进制文件例如.dll是 PE,它是带有额外标头的 COFF。看来您需要查看文件扩展名才能知道会发生什么。

有哪些文件扩展名使用 COFF 和哪些使用 PE 的完整列表?

4

3 回答 3

3

没有“哪些文件扩展名使用 COFF 和哪些使用 PE 的综合列表”。

扩展名仅用于帮助系统“映射”将用于启动所选文件的应用程序(例如,*.jpg 将被映射为由 MSPAINT.exe 启动,*.doc 将被映射为由 MSWORD 启动。 EXE ...等)。此逻辑映射是通过注册表进行的。

Microsoft可移植可执行文件 (PE) 规范从未提及任何有关文件扩展名的内容。

没有“综合清单”,根本没有清单,因为不需要这样的清单。PE 文件是其内容符合规范的文件。时期(这是大卫赫弗南在上面评论的)

您有带有 PDF 扩展名的可执行文件(在恶意软件中很常见),或 TXT,....或任何您想要的,甚至没有任何扩展名!这些可执行文件的“不寻常”扩展当然会有“副作用”,您将无法双击这些文件。但是,您可以 cmd>start 这些文件,或者使用许多 API 或 shell 函数以编程方式启动这些文件。

由于系统能够独立于其扩展启动可执行文件,因此解析完全没有问题!

希望有帮助!:-)

于 2014-01-25T00:04:10.433 回答
2

I cant comment but to add to Mike Dimmick's answer. Magic Numbers is how the executable file on linux is able to tell file types.

Wikipedia File Signatures

Extensions are used in windows to define default behaviors for parsing a binary. This can get confusing/dangerous, for example, if Program A knows how to handle/parse multiple file types (think Image Preview), a file could have the extension of one type, and be parsed as another. Windows will open Program A feeding it the file. Program A will parse the file and usually disregard the extension all together to determine how to handle the file.

This can be used in order to social engineer (trick) users into opening "familiar" file formats but hit code execution for more obscure formats.

于 2014-01-24T20:28:07.107 回答
2

寻找神奇之处:MZ由于其 MS-DOS 传统,PE 文件将始终启动。请参阅深入了解 Win32 可移植可执行文件格式的“MS-DOS 标题”部分。

MZDOS 是如何知道这是一个 EXE 文件而不是 COM - 由于历史原因,一些 Windows 控制台模式实用程序具有 .com 文件扩展名,但实际上是 PE 格式的文件。

于 2014-01-24T19:13:32.813 回答