Advertisement
Guest User

Untitled

a guest
Dec 9th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.86 KB | None | 0 0
  1. type
  2.   TVersion = record
  3.     case Integer of
  4.       0: (Minor, Major, Build, Release: Word);
  5.       1: (All: array[1..4] of Word);
  6.       2: (MS, LS: LongInt);
  7.       3: (Vr : Int64);
  8.   end;
  9.  
  10. function TVersionInfo.GetFileVersion: TVersion;
  11. begin
  12.   Result.Vr := 0;
  13. //    FixedFileInfo: PVSFixedFileInfo;
  14. // https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo
  15.   if Assigned(FixedFileInfo) then
  16.   begin
  17.     Result.MS := FixedFileInfo^.dwFileVersionMS;
  18.     Result.LS := FixedFileInfo^.dwFileVersionLS;
  19.   end;
  20. end;
  21.  
  22. function CompareVersions(pVersion1, pVersion2: TVersion): Integer;
  23. begin
  24.   Result := CompareValue(pVersion1.Vr, pVersion2.Vr);
  25. end;
  26.  
  27. function LongVersionToString(const Version: TVersion): string;
  28. begin
  29.   Result:='';
  30.   with Version do
  31.       Result := Format('%d.%d.%d.%d', [Major, Minor, Release, Build]);
  32. end;
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement