重命名" unins000.exe"在Inno Setup中编辑Install.pas Delphi单元

时间:2016-07-16 05:44:48

标签: delphi inno-setup delphi-2009 uninstaller

我想通过修改G10的源代码,让我的Inno安装脚本为卸载创建uninstaller.exe文件,而不是unins000.exe

我打开了包含以下代码的Delphi单元Inno Setup Compiler 5.5.9 Unicode

Install.pas

我想在安装程序保存卸载信息时更改此代码以创建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; 文件。

因此,如果安装程序在尝试重新安装程序时检测到旧的uninstaller.exe , uninstaller.dat , uninstaller.msg而未卸载任何旧的安装程序,则安装程序应检测到旧的uninstaller.exe并在没有任何用户确认的情况下覆盖它。

使用的编译器:uninstaller.exe

我想知道我该怎么做。我这样做只是为了测试目的。

CodeGear RAD Studio with Delphi 2009 Update 4重命名为unins000.exe后,看起来Inno安装程序无法找到卸载日志文件或任何其他错误.........

Setup Crashes on second re-installation over an old installation

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

我认为你至少拥有非常基本的编程技能:

在线上设置断点 UninstallExeFilename:= BaseFilename +'。exe';

使用IDE中的Watch检查 BaseFilename 变量。 这是什么意思?

符合您的要求应该是“卸载程序”。如果它不同,只需观看 BaseFilename 变量并检查分配给它的值。

可以注释掉或修改将此变量更改为数字的行。