抓取windows文件信息
本文采用 C 语言 (http://blogs.msdn. com/oldnewthing/archive/2006/12/21/1340571.aspx),我们已经成功地从 Windows 文件中获取文件版本信息,但是有些文件似乎具有不同的存储机制文章中未提及的版本信息,想知道是否有人有任何想法。
文件的一个示例是 system32/oledlg.dll。逐字节浏览文件,我们找到一个应该存储版本信息的块:
F^@i^@l^@e^@V^@e^@r^@s^@i^@o^@n^@^@^@^@^1.0 (x^@p^@s^@p^@.^@0^@8^@0^@4^@1^@3
^@-^@2^@1^@0^@8^@)^@^@^@^@^@.^@^G^@^A^@I^@n^@t^@e^@r^@n^@a^@l^@N^@a^@m^@e
我们可以看到是 1.0。然而,当你在windows中查看文件信息时,版本实际上是5.1.2600.5512。本文中的方法适用于大多数文件,但我遇到过一些遇到上述问题的实例。有人有这方面的经验吗?我只能访问标准 C。
根据评论中发布的后续文章,这是否意味着无法从文件信息块损坏的文件中获取实际的文件版本?
我还应该补充一点,我正在从 Windows 盒子中获取文件,然后使用 C 程序在 Linux 上检查它们以获取文件信息。
In C following this article (http://blogs.msdn.com/oldnewthing/archive/2006/12/21/1340571.aspx), we have succesfully been able to grab the file version information out of windows files however there are some files that seem to have a different mechanism for storing the version information that is not addressed in the article and was wondering if anyone had any ideas here.
One example of a file would be system32/oledlg.dll. Going through the file byte by byte we come to a chunk where the version information SHOULD be stored:
F^@i^@l^@e^@V^@e^@r^@s^@i^@o^@n^@^@^@^@^1.0 (x^@p^@s^@p^@.^@0^@8^@0^@4^@1^@3
^@-^@2^@1^@0^@8^@)^@^@^@^@^@.^@^G^@^A^@I^@n^@t^@e^@r^@n^@a^@l^@N^@a^@m^@e
That we can see is 1.0. However, when you look at the file information in windows the version is actually 5.1.2600.5512. The method in the article works for most files but there are a few instances I have come across where I am running into the above problem. Anyone have any experience with this? I only have access to standard C.
Based on the follow up article posted in the comment, does that mean there is no way to grab the actual file version from a file with a corrupted file info block?
I should also add that I am grabbing the files from a windows box, and then examining them on linux with a C program to grab the file info.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,该文件的错误信息被用于获取版本,实际上并不需要文件版本块,而是“VS_VERSION_INFO”块。
IT turns out the wrong peice of info for that file was being used to get the version, didn't actually need the File Version block but the "VS_VERSION_INFO" block.