diff --git a/InnoSetupScript/Custom_Messages.iss b/InnoSetupScript/Custom_Messages.iss index 305332e78..44bc39497 100644 --- a/InnoSetupScript/Custom_Messages.iss +++ b/InnoSetupScript/Custom_Messages.iss @@ -24,6 +24,7 @@ ;English en.msg_SetupIsRunningWarning=Subtitle Edit Setup is already running! +en.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. en.msg_AskToDownNET=Subtitle Edit requires the .NET Framework 2.0. Please download and install the .NET Framework and run setup again. %n%nDo you want to download the .NET Framework 2.0 now? en.msg_DeleteSettings=Do you also want to delete Subtitle Edit's settings and any custom changes you made in the dictionaries? %n%nIf you plan on reinstalling Subtitle Edit you do not have to delete them. en.run_VisitWebsite=Visit Subtitle Edit's Website @@ -36,6 +37,7 @@ en.tsk_ResetSettings=Reset Subtitle Edit's settings dk.msg_SetupIsRunningWarning=Subtitle Edit Setup kører allerede! +dk.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. dk.msg_AskToDownNET=Subtitle Edit kræver .NET Framework 2.0. Download and installer .NET Framework og kør setup igen. %n%nVil du downloade .NET Framework 2.0 nu? dk.msg_DeleteSettings=Vil du også slette Subtitle Edit's indstillinger og evt. ændringer i ordlister? %n%nHvis du vil geninstallere Subtitle Edit senere kan du beholde disse indstillinger. dk.run_VisitWebsite=Besøg Subtitle Edits Website @@ -48,6 +50,7 @@ dk.tsk_ResetSettings=Nulstil Subtitle Edit indstillinger es.msg_SetupIsRunningWarning=Subtitle Edit Setup is already running! +es.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. es.msg_AskToDownNET=Subtitle Edit requires the .NET Framework 2.0. Please download and install the .NET Framework and run setup again. %n%nDo you want to download the .NET Framework 2.0 now? es.msg_DeleteSettings=Do you also want to delete Subtitle Edit's settings and any custom changes you made in the dictionaries? %n%nIf you plan on reinstalling Subtitle Edit you do not have to delete them. es.run_VisitWebsite=Visit Subtitle Edit's Website @@ -60,6 +63,7 @@ es.tsk_ResetSettings=Reset Subtitle Edit's settings fr.msg_SetupIsRunningWarning=Subtitle Edit Setup is already running! +fr.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. fr.msg_AskToDownNET=Subtitle Edit requires the .NET Framework 2.0. Please download and install the .NET Framework and run setup again. %n%nDo you want to download the .NET Framework 2.0 now? fr.msg_DeleteSettings=Do you also want to delete Subtitle Edit's settings and any custom changes you made in the dictionaries? %n%nIf you plan on reinstalling Subtitle Edit you do not have to delete them. fr.run_VisitWebsite=Visit Subtitle Edit's Website @@ -72,6 +76,7 @@ fr.tsk_ResetSettings=Reset Subtitle Edit's settings it.msg_SetupIsRunningWarning=Subtitle Edit Setup is already running! +it.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. it.msg_AskToDownNET=Subtitle Edit requires the .NET Framework 2.0. Please download and install the .NET Framework and run setup again. %n%nDo you want to download the .NET Framework 2.0 now? it.msg_DeleteSettings=Do you also want to delete Subtitle Edit's settings and any custom changes you made in the dictionaries? %n%nIf you plan on reinstalling Subtitle Edit you do not have to delete them. it.run_VisitWebsite=Visit Subtitle Edit's Website @@ -84,6 +89,7 @@ it.tsk_ResetSettings=Reset Subtitle Edit's settings nl.msg_SetupIsRunningWarning=Subtitle Edit Setup is already running! +nl.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. nl.msg_AskToDownNET=Subtitle Edit requires the .NET Framework 2.0. Please download and install the .NET Framework and run setup again. %n%nDo you want to download the .NET Framework 2.0 now? nl.msg_DeleteSettings=Do you also want to delete Subtitle Edit's settings and any custom changes you made in the dictionaries? %n%nIf you plan on reinstalling Subtitle Edit you do not have to delete them. nl.run_VisitWebsite=Visit Subtitle Edit's Website @@ -96,6 +102,7 @@ nl.tsk_ResetSettings=Reset Subtitle Edit's settings pl.msg_SetupIsRunningWarning=Subtitle Edit Setup is already running! +pl.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. pl.msg_AskToDownNET=Subtitle Edit requires the .NET Framework 2.0. Please download and install the .NET Framework and run setup again. %n%nDo you want to download the .NET Framework 2.0 now? pl.msg_DeleteSettings=Do you also want to delete Subtitle Edit's settings and any custom changes you made in the dictionaries? %n%nIf you plan on reinstalling Subtitle Edit you do not have to delete them. pl.run_VisitWebsite=Visit Subtitle Edit's Website @@ -107,6 +114,7 @@ pl.tsk_Other=Other: pl.tsk_ResetSettings=Reset Subtitle Edit's settings ro.msg_SetupIsRunningWarning=Instalarea programului Subtitle Edit se efectuează deja! +ro.msg_AppIsRunning=Subtitle Edit is running! Please close it before proceeding. ro.msg_AskToDownNET=Subtitle Edit necesită .NET Framework 2.0. Vă rog să descărcaţi şi să instalaţi .NET Framework şi apoi reinstalaţi. %n%nVreţi să descărcaţi acum .NET Framework 2.0? ro.msg_DeleteSettings=Vreţi de asemenea să ştergeţi setările şi personalizările făcute în dicţionare? %n%nDacă aveţi de gând să reinstalaţi Subtitle Edit, nu este nevoie să le ştergeţi. ro.run_VisitWebsite=Vizitaţi pagina Web a programului Subtitle Edit diff --git a/InnoSetupScript/Subtitle_Edit_installer.iss b/InnoSetupScript/Subtitle_Edit_installer.iss index ca6e43291..e1621b3b8 100644 --- a/InnoSetupScript/Subtitle_Edit_installer.iss +++ b/InnoSetupScript/Subtitle_Edit_installer.iss @@ -21,7 +21,7 @@ ; Inno Setup QuickStart Pack Unicode v5.3.11(+): http://www.jrsoftware.org/isdl.php#qsp -#define installer_build_number "04" +#define installer_build_number "05" #define VerMajor #define VerMinor @@ -113,6 +113,7 @@ Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm [Files] +Source: psvince.dll; DestDir: {app}; Flags: ignoreversion Source: ..\src\Changelog.txt; DestDir: {app}; Flags: ignoreversion Source: ..\src\gpl.txt; DestDir: {app}; Flags: ignoreversion Source: ..\src\Bin\Release\Hunspellx86.dll; DestDir: {app}; Flags: ignoreversion @@ -187,6 +188,15 @@ var is_update: Boolean; +// General functions +function IsModuleLoaded(modulename: AnsiString ): Boolean; +external 'IsModuleLoaded@files:psvince.dll stdcall setuponly'; + + +function IsModuleLoadedU(modulename: AnsiString ): Boolean; +external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly'; + + // Check if Subtitle Edit's settings exist function SettingsExistCheck(): Boolean; begin @@ -264,11 +274,18 @@ begin // Create a mutex for the installer and if it's already running then expose a message and stop installation if CheckForMutexes(installer_mutex_name) then begin if not WizardSilent() then - MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbCriticalError, MB_OK); + MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK); exit; end; CreateMutex(installer_mutex_name); + if IsModuleLoaded( 'SubtitleEdit.exe' ) then begin + MsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK ); + Result := False; + Abort; + end else + Result := True; + // Check if .NET Framework 2.0 is installed and if not offer to download it try ExpandConstant('{dotnet20}'); @@ -293,11 +310,25 @@ end; function InitializeUninstall(): Boolean; begin - Result := True; - if CheckForMutexes(installer_mutex_name) then begin - if not WizardSilent() then - MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbCriticalError, MB_OK); - exit; - end; - CreateMutex(installer_mutex_name); + // Check if app is running during uninstallation + if IsModuleLoadedU( 'SubtitleEdit.exe' ) then begin + MsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK ); + Result := False; + end + else Result := True; + + if NOT IsModuleLoadedU( 'SubtitleEdit.exe' ) then begin + Result := True; + if CheckForMutexes(installer_mutex_name) then begin + if not WizardSilent() then + MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK); + Result := False; + end + else begin + CreateMutex(installer_mutex_name); + end; + end; + + // Unload the psvince.dll in order to be uninstalled + UnloadDLL(ExpandConstant('{app}\psvince.dll')); end; diff --git a/InnoSetupScript/psvince.dll b/InnoSetupScript/psvince.dll new file mode 100644 index 000000000..e910509d0 Binary files /dev/null and b/InnoSetupScript/psvince.dll differ