C library to read EXE version from Linux?

后端 未结 5 1875
孤独总比滥情好
孤独总比滥情好 2021-02-08 11:24

Is there a library I can use in Linux that will return the properties of a Windows EXE file that are listed in Explorer\'s Version tab? These are fields like Product Name, Produ

5条回答
  •  生来不讨喜
    2021-02-08 11:49

    Here is a patch for code to support PE32+. Tested on some files and seems to work.

    //optHeader is a IMAGE_OPTIONAL_HEADER32
    const char *optHeader = coff + 20;
    WORD magic = READ_WORD(optHeader);
    if (magic != 0x10b && magic != 0x20b)
        return NULL;
    
    //dataDir is an array of IMAGE_DATA_DIRECTORY
    const char *dataDir = optHeader + (magic==0x10b ? 96: 112);
    DWORD vaRes = READ_DWORD(dataDir + 8*2);
    

提交回复
热议问题