<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 06.11.2013 15:39, schrieb Antonio
Fortuny:<br>
</div>
<blockquote cite="mid:527A54B2.5040505@sitasoftware.lu" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<br>
<div class="moz-cite-prefix">Le 06/11/2013 14:41, Anton Kavalenka
a écrit :<br>
</div>
<blockquote cite="mid:527A46F3.6020600@tut.by" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<font face="Liberation Sans">The unit versionresource</font> is
part of package fcl-res <br>
</blockquote>
I already use it for Linux with a Linux executable file<br>
<blockquote cite="mid:527A46F3.6020600@tut.by" type="cite"> <br>
Unit allow x-platform version resource extraction and parsing.<br>
rsrc:=TVersionResource.Create;<br>
Stream := TResourceStream.CreateFromID(<b><big>hMod</big></b>,
1, PChar(RT_VERSION));<br>
</blockquote>
What's <b><big>hMod </big></b>stands for ? Looks like a pointer
of so (PtrUint)<br>
<blockquote cite="mid:527A46F3.6020600@tut.by" type="cite">
rsrc.SetCustomRawDataStream(Stream);<br>
with res do<br>
case it of<br>
vsFileVersion:<br>
Result:=format('%d.%d.%d.%d',[FileVersion[0],FileVersion[1],FileVersion[2],FileVersion[3]]);<br>
vsProductVersion:<br>
Result:=format('%d.%d.%d.%d',[ProductVersion[0],ProductVersion[1],ProductVersion[2],ProductVersion[3]]);<br>
end;<br>
<br>
</blockquote>
</blockquote>
Hmm... nice... we already seem to have cross platform support :)<br>
<br>
You could try something like this (untested, just made up from the
code I see in fcl-res!):<br>
<br>
=== code begin ===<br>
<br>
uses<br>
resource, winpeimagereader, elfreader, versionresource;<br>
<br>
var<br>
res: TResources;<br>
abstrres: TAbstractResource;<br>
begin<br>
res := TResources.Create;<br>
try<br>
res.LoadFromFile('whatever.exe'); // or 'whatever' for ELF files<br>
abstrres := res.Find(RT_VERSION, 1);<br>
if abstrres is TVersionResource then<br>
...<br>
finally<br>
res.Free;<br>
end;<br>
end.<br>
<br>
=== code end ===<br>
<br>
Regards,<br>
Sven<br>
</body>
</html>