Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Get file version - something wrong

  Alt 13. Aug 2014, 11:41
Delphi-Version: XE5
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?

Geändert von WojTec (13. Aug 2014 um 11:45 Uhr)
  Mit Zitat antworten Zitat