The following code works:
[Code]
var
ComMD5: Integer;
FileExit: Boolean;
function InitializeSetup: boolean;
begin
FileExit := FileExists(ExpandConstant('C:\Program Files (x86)\A\A.exe'));
if FileExit = false then begin
MsgBox('File does not exist!', mbInformation, MB_OK);
Result := False;
end else begin
ComMD5 := CompareStr(GetMD5OfFile(ExpandConstant('C:\Program Files (x86)\A\A.exe')), 'c2d33f81e31eb54adf9323c27a9af536');
if ComMD5 = 0 then begin
MsgBox('The file version is incorrect, please install the correct version!', mbInformation, MB_OK);
Result := False;
end else
Result := True;
end;
end;
I want to perform MD5 verification on multiple versions, what should I do?
Condition: A.exe has been installed (there are 5 versions of A.exe successively, MD5 are aMD5/bMD5/cMD5/dMD5/eMD5 respectively).
Use the installation package made by Inno Setup to compare the MD5 of A.exe at runtime.
If equal to aMD5 or bMD5, the installer should continue.
If it is equal to cMD5 or dMD5 or eMD5, it should display
The file version is incorrect, please install the correct version!