I want to make my Inno Setup Script create uninstaller.exe
files for Uninstallation, not the unins000.exe
by modifying the Source Code of Inno Setup Compiler 5.5.9 Unicode
.
I opened the Delphi Unit Install.pas
which have these codes:
procedure GenerateUninstallInfoFilename;
var
ExistingFiles: array[0..999] of Boolean;
BaseDir: String;
procedure FindFiles;
var
H: THandle;
FindData: TWin32FindData;
S: String;
begin
H := FindFirstFile(PChar(AddBackslash(BaseDir) + 'unins???.*'),
FindData);
if H <> INVALID_HANDLE_VALUE then begin
repeat
S := FindData.cFilename;
if (Length(S) >= 9) and (CompareText(Copy(S, 1, 5), 'unins') = 0) and
CharInSet(S[6], ['0'..'9']) and CharInSet(S[7], ['0'..'9']) and CharInSet(S[8], ['0'..'9']) and
(S[9] = '.') then
ExistingFiles[StrToInt(Copy(S, 6, 3))] := True;
until not FindNextFile(H, FindData);
Windows.FindClose(H);
end;
end;
procedure GenerateFilenames(const I: Integer);
var
BaseFilename: String;
begin
BaseFilename := AddBackslash(BaseDir) + Format('unins%.3d', [I]);
UninstallExeFilename := BaseFilename + '.exe';
UninstallDataFilename := BaseFilename + '.dat';
UninstallMsgFilename := BaseFilename + '.msg';
end;
I want to change this code to create uninstaller.exe , uninstaller.dat , uninstaller.msg
files when the Setup saves Uninstall Information.
So, if setup detects the old uninstaller.exe
when trying to reinstall my program without uninstalling its any old Installation, Setup should detect that old uninstaller.exe
and overwrite it without any user Confirmation.
Compiler Used: CodeGear RAD Studio with Delphi 2009 Update 4
.
I like to know how can I do this.I will do this for testing purpose only.
After Renaming the unins000.exe
to uninstaller.exe
, looks like Inno Setup can't find uninstall log files or any other error.........
Thank You For Your Help.
I suppose you have at least very basic programming skills:
Put a breakpoint on line UninstallExeFilename := BaseFilename + '.exe';
Check the BaseFilename variable using Watch in IDE. What does it say?
It should be 'uninstaller' to match your requirement. If it is different them simply watch BaseFilename variable and check the value assigned to it.
The line that changes this variable to numbers can be commented out or modified.