diff --git a/DnsServiceSetup/Windows/DnsServiceSetup.iss b/DnsServiceSetup/Windows/DnsServiceSetup.iss index 38bd1ea6..349828da 100644 --- a/DnsServiceSetup/Windows/DnsServiceSetup.iss +++ b/DnsServiceSetup/Windows/DnsServiceSetup.iss @@ -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; diff --git a/DnsServiceSetup/Windows/DnsServiceSetup.pas b/DnsServiceSetup/Windows/DnsServiceSetup.pas index 33c25110..da6c916b 100644 --- a/DnsServiceSetup/Windows/DnsServiceSetup.pas +++ b/DnsServiceSetup/Windows/DnsServiceSetup.pas @@ -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; \ No newline at end of file diff --git a/DnsServiceSetup/Windows/logo.bmp b/DnsServiceSetup/Windows/logo.bmp new file mode 100644 index 00000000..8659111e Binary files /dev/null and b/DnsServiceSetup/Windows/logo.bmp differ diff --git a/DnsServiceSetup/Windows/logo.ico b/DnsServiceSetup/Windows/logo.ico new file mode 100644 index 00000000..67432fd8 Binary files /dev/null and b/DnsServiceSetup/Windows/logo.ico differ