After installing our SW we run a small program that compares properties of the installed files (size, file version, MD5 chacksum) to show the customers that the installation is correct.
I use the "extract version info" to get the file version (I tried both "FileVersion" and "File Version"). The string I get from this action is not the same as the string I generate with the test program (written in Delphi7, see the code below).
My code FinalBuilder result
------------------------------
4.1.1.13 4.1.1.13
1.0.0.9 1.0.009
2.0.0.0 2.0.0.0
6.0.84.18 6.00.8418
6.0.81.69 6.00.8169
2.1.0.651 2.01.0651
1.1.0.65 1.01.0065
1.0.0.0 1.00
The table shows that the values are the same, but that the formattting (commas and leading zeroes) is different. My code is:
function GetFixedFileVerInfo(const FileName: string; out FFI: Windows.TVSFixedFileInfo): Boolean;
var
VerInfoBuf: Pointer; // points to memory storing version info
VerInfoSize: Integer; // size of version info memory
Dummy: Windows.THandle; // unused parameter required by API function
PFFI: Pointer; // points to fixed file info
FFISize: LongWord; // size of file file info returned from API (unused)
begin
// Assume failure: sets zero result
FillChar(FFI, SizeOf(FFI), 0);
Result := False;
// Get size of version info: there is none if this is zero
VerInfoSize := Windows.GetFileVersionInfoSize(PChar(FileName), Dummy);
if VerInfoSize > 0 then
begin
// Allocate memory to store ver info
GetMem(VerInfoBuf, VerInfoSize);
try
// Get the version info, filling buffer
if Windows.GetFileVersionInfo(PChar(FileName), Dummy, VerInfoSize, VerInfoBuf) then
begin
// Get a pointer to fixed file info
if Windows.VerQueryValue(VerInfoBuf, '\', PFFI, FFISize) then
begin
// Got pointer OK: record file version
FFI := Windows.PVSFixedFileInfo(PFFI)^;
Result := True;
end;
end;
finally
// Dispose of ver info storage
FreeMem(VerInfoBuf, VerInfoSize);
end;
end;
end;
...
if GetFixedFileVerInfo(FullFileName, FFI) then
begin
ActualVersion := Format('%d.%d.%d.%d', [HiWord(FFI.dwFileVersionMS),
LoWord(FFI.dwFileVersionMS),
HiWord(FFI.dwFileVersionLS),
LoWord(FFI.dwFileVersionLS)]);
end;
...
My question now is how should I modify my code to get the same formatting as the FinalBuilder action.