I want to get version info from executable, so I checked
MSDN and wrote something like this:
Delphi-Quellcode:
Size := GetFileVersionInfoSize(PChar(AFileName), hWnd);
if Size > 0
then
begin
GetMem(Buffer, Size);
try
if GetFileVersionInfo(PChar(AFileName), hWnd, Size, Buffer)
then
begin
if VerQueryValue(Buffer, '
\', Pointer(FixedFileInfo), L)
then
begin
if VerQueryValue(Buffer, PChar('
\VarFileInfo\Translation'), Pointer(pD), L)
then
begin
Translation := IntToHex(pD^, 8);
Temp := Copy(Translation, 5, 4);
if StrToIntDef('
$' + Temp, 0) = 0
then
Temp := IntToHex(1033, 4)
;
Translation := Temp + Copy(Translation, 1, 4);
end
else
Translation := '
040904E4'
;
// Here query for values
I checked on 16, 32 and 64 bit files and working well in most cases, but not for all
For example for firefox.exe returns nulls (but
query for translation passes)
What's wrong with this?