Commit 74905225 authored by Ludovic Fauvet's avatar Ludovic Fauvet

nsis: kill VLC before copying/updating any file

During silent installations (/S) the installer will automatically kill
(without warning) any running instance of VLC before copying files.

Silent updates should now work using the flags /S /update.
parent 719085f1
......@@ -239,4 +239,31 @@ Function un.RemoveEmptyDirs
"${Index}-End:"
FindClose $0
!undef Index
FunctionEnd
\ No newline at end of file
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check if VLC is running and kill it if necessary ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function CheckRunningProcesses
${nsProcess::FindProcess} "vlc.exe" $R0
StrCmp $R0 0 0 end
IfSilent +3
BringToFront
MessageBox MB_OKCANCEL|MB_ICONQUESTION $MessageBox_VLCRunning IDCANCEL stop
${nsProcess::CloseProcess} "vlc.exe" $R0
IfSilent end
StrCmp $R0 0 end 0 ; Success
StrCmp $R0 603 end 0 ; Not running
MessageBox MB_OK|MB_ICONEXCLAMATION $MessageBox_VLCUnableToClose
goto end
stop:
${nsProcess::Unload}
MessageBox MB_OK|MB_ICONEXCLAMATION $MessageBox_InstallAborted
Quit
end:
${nsProcess::Unload}
FunctionEnd
......@@ -47,6 +47,11 @@ Var Action_OnArrivalDVDAudio
Var License_NextText
Var Detail_CheckProcesses
Var MessageBox_VLCRunning
Var MessageBox_VLCUnableToClose
Var MessageBox_InstallAborted
Var Reinstall_Headline
Var Reinstall_HeadlineInstall
Var Reinstall_HeadlineMaintenance
......
......@@ -59,6 +59,11 @@ StrCpy $Action_OnArrivalDVDAudio "Play audio DVD"
StrCpy $License_NextText "You are now aware of your rights. Click Next to continue."
StrCpy $Detail_CheckProcesses "Checking processes..."
StrCpy $MessageBox_VLCRunning "VLC appears to be running and will now be closed."
StrCpy $MessageBox_VLCUnableToClose "This installer was unable to close VLC, please do it manually."
StrCpy $MessageBox_InstallAborted "Installation aborted!"
StrCpy $Reinstall_Headline "Already Installed"
StrCpy $Reinstall_HeadlineInstall "Choose how you want to install VLC."
StrCpy $Reinstall_HeadlineMaintenance "Choose the maintenance option to perform."
......
......@@ -60,6 +60,7 @@ RequestExecutionLevel user
!addincludedir NSIS
!addplugindir NSIS
!include UAC.nsh
!include nsProcess.nsh
!include WinVer.nsh
!include FileFunc.nsh
!include MUI2.nsh
......@@ -167,6 +168,9 @@ ${MementoSection} $Name_Section01 SEC01
SetShellVarContext all
SetOutPath "$INSTDIR"
DetailPrint $Detail_CheckProcesses
Call CheckRunningProcesses
!insertmacro OpenUninstallLog
; VLC.exe, libvlc.dll
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment