CAB 文件如何成为 PE 文件?

How is a CAB file a PE file?

OSR published a Q&A session 与 Microsoft 的某人在他们的博客上。主题是 Windows 10 驱动程序签名与早期 Windows 版本相比的要求变化。

微软项目经理 James Murray 在一份声明中说(粗体部分):

Peter: The new driver signing procedure indicates you have to build a CAB file to upload for signing, and you sign that CAB file with your EV Cert. Why a CAB file (and not something common like a ZIP archive)? How do you build the CAB file? Is there a particular process or tool to use?

James: CAB was chosen as CABs themselves are PE files. This simplifies the signing process somewhat, as signtool.exe has “native” support. If we had chosen a ZIP Archive (note, we’d still like to move that direction), we would have needed to provide a separate signing mechanism. Something akin to the HLK studio, a small tool with the capability to sign ZIP or OPCs.

这让我很惊讶。我知道很多 PE/COFF 的细节,但从来没有觉得 CAB 文件适合那里。它似乎也不是关于包含 CAB 的自解压可执行文件。

我必须在我的十六进制编辑器中打开一个 CAB 文件才能亲眼看到它,但不知何故我无法看出该陈述在何种意义上是正确的。

任何人都可以提供有关 how/why CAB 文件的详细信息 PE 文件吗?

CAB 文件通常不是 PE 文件 - 它们具有完全不同的结构。

例如,CAB file structure starts with the characters 'M', 'S', 'C', 'F' to identifiy it as a Microsoft Cabinet File - while a PE file's structure 通常以可执行的 MS-DOS 存根开头。

可能创建一个兼具两者的文件:两种格式都允许一定程度的灵活性,包括保留区域,这可能允许两种格式的约束一下子就满足了。但一般情况下,cabinet 文件不是有效的 PE 文件。

我希望 Murray 先生知道 signtool 实用程序可以处理 PE 文件和 CAB 文件,并假设那是因为 CAB 文件是 PE 文件的特例,但实际上该工具只有原生支持两种格式。