Commit 7e27efaa authored by Marvin Scholz's avatar Marvin Scholz

NSIS: Properly detect 32bit VLC

Previously the 64bit installer would not detect if a 32bit VLC
is already installed, this can lead to situations where two VLC
versions are installed on the system, one 32bit and one 64bit.
Windows will only show one version, as they have exactly the same
name in the start menu and shortcuts.
Even though the registry values are different for 32bit and 64bit,
the Apps list of Windows will only show one of them too.
(Except the old non-UWP one)

Therefore we really need to avoid this case. With this commit, if the
user has a 32bit VLC installed, it will be uninstalled first before
installing a 64bit version.

(cherry picked from commit 7aa50962)
Signed-off-by: Marvin Scholz's avatarMarvin Scholz <epirat07@gmail.com>
parent 475a482a
......@@ -21,6 +21,8 @@
!define MEMENTO_REGISTRY_ROOT ${PRODUCT_UNINST_ROOT_KEY}
!define MEMENTO_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
@HAVE_WIN64_TRUE@ !define VLC_64BIT_INSTALLER
ManifestDPIAware true
Unicode true
......@@ -35,6 +37,9 @@ Var PreviousVersionState
Var PreviousInstallDir
Var UninstallLog
Var 32bitUninstaller
Var 32bitPath
;;;;;;;;;;;;;;;;;;;;;;;;;
; General configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;
......@@ -255,6 +260,28 @@ ${MementoSection} "$(Name_Section01)" SEC01
DetailPrint "$(Detail_CheckProcesses)"
Call CheckRunningProcesses
; Remove 32 bit version first
!ifdef VLC_64BIT_INSTALLER
${If} $32bitPath != ""
; Run uninstaller
ClearErrors
ExecWait '"$32bitUninstaller" /S _?=$32bitPath'
; If uninstall was not successfull, do not continue.
; This happens for example if the user cancels the uninstaller.
${If} ${Errors}
Goto skip_uninstall32_cleanup
${EndIf}
${If} ${FileExists} "$32bitUninstaller"
Delete "$32bitUninstaller"
RMDir "$32bitPath"
${EndIf}
${EndIf}
!endif
skip_uninstall32_cleanup:
; Remove previous version first, if this is update
${If} $ReinstallType == "1"
FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
......@@ -575,6 +602,21 @@ WinOk:
; /update argument
Call ParseCommandline
; See if a other bitness VLC version exists
!ifdef VLC_64BIT_INSTALLER
SetRegView 32
Call ReadPreviousVersion
${If} $PreviousVersion != ""
ReadRegStr $32bitUninstaller ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
ReadRegStr $32bitPath ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
StrCpy $PreviousVersion ""
${EndIf}
SetRegView lastused
!endif
; See if previous version exists
Call ReadPreviousVersion
......
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