type
   PFixedFileInfo = ^TFixedFileInfo;
   TFixedFileInfo = record
      Signature: DWord;
      StrucVersion: DWord;
      Minor: Word;
      Major: Word;
      Build: Word;
      Release: Word;
      FileFlagsMask: DWord;
      FileFlags: DWord;
      FileOS: DWord;
      FileType: DWord;
      FileSubtype: DWord;
      FileDateMS: DWord;
      FileDateLS: DWord;
   end;
   function GetFileInfo(const AFileName: string): TFixedFileInfo;
 var
   Handle, VersionSize: DWORD;
   SubBlock: string;
   Temp: Pointer;
   Data: Pointer;
 begin
   SubBlock := '\';
   VersionSize := GetFileVersionInfoSize(PChar(AFileName), Handle);
   if VersionSize > 0 then
   begin
     GetMem(Temp, VersionSize);
     try
       if GetFileVersionInfo(PChar(AFileName), Handle, VersionSize, Temp) then
         if VerQueryValue(Temp, PChar(SubBlock), Data, VersionSize) then
           Result := PFixedFileInfo(Data)^;
     finally
       FreeMem(Temp);
     end;
   end else
     RaiseLastOSError;
 end;
   function GetBuild(const AFileName: TFileName): string;
 begin
   with GetFileInfo(AFileName) do
     Result := Format('%d.%d.%d.%d', [Major, Minor, Release, Build]);
 end;
   |