mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-02-23 00:07:28 +00:00
Additional improvements to installer
Fix installer to properly kill tray app. Add icon and image to installer. Add some sleep when stopping and removing service.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#define TITLE "Technitium DNS Server"
|
||||
#define FILES_LOCATION "..\..\DnsService\bin\Release"
|
||||
#define TRAYAPP_LOCATION "..\..\DnsServerSystemTrayApp\obj\Release"
|
||||
#define TRAYAPP_FILENAME "DnsServerSystemTrayApp.exe"
|
||||
|
||||
[Setup]
|
||||
PrivilegesRequired=admin
|
||||
@@ -18,10 +19,13 @@ AppCopyright=Copyright (c) 2021 {#COMPANY}
|
||||
AppPublisher={#COMPANY}
|
||||
OutputDir=..\Release
|
||||
OutputBaseFilename=DnsServiceSetup
|
||||
CloseApplications=no
|
||||
Compression=lzma2/max
|
||||
SetupIconFile=logo.ico
|
||||
WizardSmallImageFile=logo.bmp
|
||||
|
||||
[Files]
|
||||
Source: "{#TRAYAPP_LOCATION}\DnsServerSystemTrayApp.exe"; DestDir: "{app}";
|
||||
Source: "{#TRAYAPP_LOCATION}\{#TRAYAPP_FILENAME}"; DestDir: "{app}"; BeforeInstall: KillTrayApp;
|
||||
Source: "{#FILES_LOCATION}\*.*"; Excludes: "*.pdb,DnsService.exe"; DestDir: "{app}"; Flags: recursesubdirs;
|
||||
Source: "{#FILES_LOCATION}\DnsService.exe"; DestDir: "{app}"; Flags: recursesubdirs; BeforeInstall: DoRemoveService; AfterInstall: DoInstallService;
|
||||
|
||||
|
||||
@@ -25,6 +25,18 @@ begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
procedure TaskKill(fileName: String);
|
||||
var
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
Exec(ExpandConstant('taskkill.exe'), '/f /im ' + '"' + fileName + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||
end;
|
||||
|
||||
procedure KillTrayApp; //Kill the tray app. Inno Setup cannot seem to close it through the "Close Applications" dialog.
|
||||
begin
|
||||
TaskKill('{#TRAYAPP_FILENAME}');
|
||||
end;
|
||||
|
||||
procedure DoRemoveService(); //Removes the dns service from the scm
|
||||
begin
|
||||
if IsServiceInstalled(ExpandConstant('{cm:ServiceName}')) then begin
|
||||
@@ -32,11 +44,12 @@ begin
|
||||
if IsServiceRunning(ExpandConstant('{cm:ServiceName}')) then begin
|
||||
Log('Service: Already running');
|
||||
StopService(ExpandConstant('{cm:ServiceName}'));
|
||||
Sleep(5000);
|
||||
Sleep(3000);
|
||||
end;
|
||||
|
||||
Log('Service: Remove');
|
||||
RemoveService(ExpandConstant('{cm:ServiceName}'))
|
||||
RemoveService(ExpandConstant('{cm:ServiceName}'));
|
||||
Sleep(3000);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -61,6 +74,7 @@ procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||
begin
|
||||
if CurUninstallStep = usUninstall then
|
||||
begin
|
||||
KillTrayApp();
|
||||
DoRemoveService();
|
||||
end;
|
||||
end;
|
||||
BIN
DnsServiceSetup/Windows/logo.bmp
Normal file
BIN
DnsServiceSetup/Windows/logo.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
DnsServiceSetup/Windows/logo.ico
Normal file
BIN
DnsServiceSetup/Windows/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
Reference in New Issue
Block a user