[Lazarus] Program version

Sven Barth pascaldragon at googlemail.com
Thu Nov 7 16:09:16 CET 2013

Am 07.11.2013 15:08, schrieb Antonio Fortuny:
> Hi again.
> I succeeded to make one source unit which when used into any Lazarus 
> unit, gives the version of any file as far as the file :
> - has been compiled whith Lazarus or Delphi
> - version information is in the resource data ad hoc (as Lazarus and 
> Delphi provide)
> The file to analyze can be any executable file provided that the 
> standard OS signatures are at the beginning of the file:
> - 'MZ' as the first two chars of the file for any windows program 
> (inclusive WinCE)
> - #127+'ELF' as the first four chars of a Linux executable file
> The unit can be compiled by Lazarus (or FPC I guess) on Win32, Win64, 
> Linux x86_64 (I guess i386 too)
> Targets can be Win32, WinCE, Win64, Linux x86_64
> A program using the version unit runs on Win32, win64, winCE, Linux 
> x86_64
> Whatever the target can be, there is no need to change anything. Same 
> source runs on all named platforms.
> In case of trouble, the unit is supposed not to blow up. It gives a 
> blank version intead.ยต
> See th source unit as attachment.
Note: as you are using the platform independant fcl-res it should run on 
any platform where fcl-res is supported and can read any PE (Win32, 
Win64, WinCE, NativeNT) or ELF (all supported Linux and likely also 
supported FreeBSD, NetBSD and OpenBSD systems and maybe also others 
(Solaris?)) binary where we support using resources.


More information about the Lazarus mailing list