[vlc-commits] NSIS: Properly detect 32bit VLC

Marvin Scholz git at videolan.org
Tue Feb 6 22:29:54 CET 2018


vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Mon Jan 22 23:27:32 2018 +0100| [7e27efaa491c4983b41bb78cc19e715a95fc9894] | committer: 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 7aa509623c3efb128dc1cb634e40ea3b3135869f)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7e27efaa491c4983b41bb78cc19e715a95fc9894
---

 extras/package/win32/NSIS/vlc.win32.nsi.in | 42 ++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/extras/package/win32/NSIS/vlc.win32.nsi.in b/extras/package/win32/NSIS/vlc.win32.nsi.in
index 0096a93271..1169c1eecd 100644
--- a/extras/package/win32/NSIS/vlc.win32.nsi.in
+++ b/extras/package/win32/NSIS/vlc.win32.nsi.in
@@ -21,6 +21,8 @@
 !define MEMENTO_REGISTRY_ROOT ${PRODUCT_UNINST_ROOT_KEY}
 !define MEMENTO_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
 
+ at 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
 



More information about the vlc-commits mailing list