Problem with VerQueryValue
I'm using the VerQueryVal to obtain the company name from a data structure acquired by GetFileVersionInfo, but it's returning strange results. Here is the code snippet:
If I put a debug in at the sprintf line, I notice that for the file C:\Windows\System\sti.dll (manufactured by Microsoft, and according to the properties is in US English), I get a code of 08d00041.
res2 = VerQueryValue(fdata, "\\VarFileInfo\\Translation", &lpXlate, &lpXlatelen); // Get translation details
found = 0; // Not found a company name yet
i = 0;
while (found == 0 && i < (lpXlatelen / sizeof(LANGANDCODEPAGE)))
hr = sprintf(workbuf, "\\StringFileInfo\\%04x%04x\\CompanyName", lpXlate.wLanguage, lpXlate.wCodePage); // Get the Company Name request string
if (hr > 0)
// Get company name details (returns non-zero if successful)
found = VerQueryValue(fdata, workbuf, &fcompany, &fcompanylen);
i ++; // Next iteration
The next file, C:\Windows\System\ole32.dll (also in US English, made by M$) gives a translation and code page of 0c740041.
The VerQueryValue to return the company name in each case gives me nothing at all.
Any ideas why I'm getting strange results? This is on my Win98 box; I'll test on my XP laptop later today but I do need this to work on both platforms.
There is only one iteration each time, so it's not as if there are multiple languages and I'm only seeing the first one.