I am really confused with this function. Currently I am successful in retrieving the FileVersion
and ProductVersion
. Now I want to retrieve more information within the application, like FileDescription
and CompanyName
.
DWORD dwLen;
VS_FIXEDFILEINFO *pFileInfo;
UINT pLenFileInfo;
dwLen = GetFileVersionInfoSize("D:/firefox.exe", NULL);
BYTE *sKey = new BYTE[dwLen];
GetFileVersionInfo("D:/firefox.exe", NULL, dwLen, sKey);
VerQueryValue(sKey, "\", (LPVOID*)&pFileInfo, &pLenFileInfo);
// at now i can retrieve file Version with structure VS_FIXEDFILEINFO
VerQueryValue(sKey, "\StringFileInfo\%04x%09x\FileDescription", (LPVOID*) &pFileInfo, &pLenFileInfo);
delete[] sKey;
cout << pFileInfo;
// it return address buffer `00230428`;
How exactly can I return the FileDescription
, like Firefox
? What structure is used to retrieve the FileDescription
in the 3rd LPVOID
parameter? In my code, I pass pFileInfo
twice into VerQueryValue()
.
EDIT:
DWORD dwLen;
struct LANGANDCODEPAGE {
WORD wLanguage;
WORD wCodePage;
} *lpTranslate;
dwLen = GetFileVersionInfoSize("D:/firefox.exe", NULL);
BYTE *sKey = new BYTE[dwLen];
TCHAR *sCompanyName = new char[1024];
GetFileVersionInfo("D:/firefox.exe", NULL, dwLen, sKey);
VerQueryValue(sKey, "\VarFileInfo\Translation", (LPVOID*)&lpTranslate, &pLenFileInfo);
VerQueryValue(test, "\StringFileInfo\%04x%09x\FileDescription", (LPVOID*)&sCompanyName, &pLenFileInfo);
delete[] sKey;
cout << lpTranslate -> wLanguage;
See Question&Answers more detail:os