Grabbing windows file information
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 standa开发者_C百科rd 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.
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.
精彩评论