Search code examples
portable-executable

Is VS_VERSION_INFO a ResourceDirectory/ResourceEntry and does it have a name or Id?


I am trying to fix an issue with ilrepack a clone of ilmerge. However, I am having trouble understanding a fundamental concept of the PE file format to fix it "correctly".

All the binaries I am merging have an entry without an Id or a Name:

ResourceEntry with no Id or Name

The data in each of them appears to be the VS_VERSION_INFO struct.

        "ϐ4\0VS_VERSION_INFO\0\0ҽﻯ\0\t\0䴶ኒ\t\0䴶ኒ?\0\0\0\0\0\0\0\0\0\0\0D\0VarFileInfo\0\0$\0Translation\0\0\0Ұ̰\0StringFileInfo\0̌\0000004b0\0LCompanyName\0\0Just A Programmer LLC\0\\FileDescription\0\0AppDomainPowerShellRunner\0@FileVersion\0\00.9.4754.19766\0\0TInternalName\0JustAProgrammer.ADPR.dll\0\0|,LegalCopyright\0Copyright © Just A Programmer LLC 2011-2012\0\\OriginalFilename\0JustAProgrammer.ADPR.dll\0\0TProductName\0\0AppDomainPowershellRunner\0DProductVersion\00.9.4754.19766\0\0HAssembly Version\00.9.4754.19766\0\0"   string

From everything I've read on IMAGE_RESOURCE_DIRECTORY, it seem that Resource Entries have either a name or an id.

struct IMAGE_RESOURCE_DIRECTORY
{
    long Characteristics;
    long TimeDateStamp;
    short MajorVersion;
    short MinorVersion;
    short NumberOfNamedEntries;
    short NumberOfIdEntries;
}

So my questions are:

  • Is VS_VERSION_INFO a Resource Entry or Resource Directory? If not, in what section of the PE does it belong?
  • Does it have an Id?
  • Does it have a Name?

Solution

  • As a matter of fact, your statement "From everything I've read on IMAGE_RESOURCE_DIRECTORY, it seem that Resource Entries have either a name or an id." is correct! Items in the Resources Directory, ALWAYS have either an ID or a Name (in this order!).

    Yes, the VS_VERSION_INFO is a member of the Resource Directory, its ID is 16. No, it does not have a name (since it is a built-in resource type).

    here below, a snaphost of Truecrypt image showing its Version Info Resource item (using CFF Explorer)

    enter image description here