[vlc-devel] [PATCH] NSIS: Properly detect other bitness VLC
Steve Lhomme
robux4 at ycbcr.xyz
Tue Jan 23 08:34:20 CET 2018
Le 22/01/2018 à 23:27, Marvin Scholz a écrit :
> Previously the installer would not detect if another bitness 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.
>
> Therefore we really need to avoid this case. With this commit, if the
> user has a different bitness version of VLC installed, a dialog is
> shown that prompts to uninstall the other version first and launches an
> uninstaller.
> If the uninstaller is successful, installation will continue, else
> it will abort.
Don't know about the code itself but on principle I think this is
correct and welcome.
> What this does not cover, is the version compare with the other
> bitness VLC version. So if the user has 32bit VLC 5.0 installed
> and tries to install a 64bit VLC 4.0, it would still prompt for the
> VLC 5.0 version to be uninstalled, as it is the other bitness,
> even though this installer will install an older version!
>
> But this scenario is even possible right now, because the installer
> will not even notice the other version at all. Even worse, there the
> user gets no prompt at all about another version of VLC already on the
> system, so this commit definitely improves the situation.
I think downgrading may be a feature rather than a bug.
> ---
> extras/package/win32/NSIS/vlc.win32.nsi.in | 46 ++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/extras/package/win32/NSIS/vlc.win32.nsi.in b/extras/package/win32/NSIS/vlc.win32.nsi.in
> index 7f6a6968bf..d1d446c18d 100644
> --- a/extras/package/win32/NSIS/vlc.win32.nsi.in
> +++ b/extras/package/win32/NSIS/vlc.win32.nsi.in
> @@ -536,6 +536,7 @@ ${MementoSectionRestore}
> @HAVE_WIN64_TRUE@ MessageBox MB_OK|MB_ICONSTOP "This version of VLC only runs on 64-bit operating systems.$\nPlease get the 32-bit version and try again."
> @HAVE_WIN64_TRUE@ Quit
> @HAVE_WIN64_TRUE@ ${EndUnless}
> + at HAVE_WIN64_TRUE@ !define VLC_64BIT_INSTALLER
> ${If} ${AtLeastWinXP}
> ${If} ${IsWinXP}
> ${AndIf} ${AtMostServicePack} 1
> @@ -558,6 +559,51 @@ WinOk:
> ; /update argument
> Call ParseCommandline
>
> + !ifdef VLC_64BIT_INSTALLER
> + !define OTHER_BITNESS 32
> + !else
> + !define OTHER_BITNESS 64
> + !endif
> +
> + ; See if a other bitness VLC version exists
> + SetRegView ${OTHER_BITNESS}
> + Call ReadPreviousVersion
> + SetRegView lastused
> +
> + ${If} $PreviousVersion != ""
> + ; Uninstall the other bitness bit version!
> + MessageBox MB_OK|MB_ICONSTOP "An ${OTHER_BITNESS}bit version of VLC was detected, it must be uninstalled first!"
It must ? I think it's better but not necessarily mandatory.
> +
> + SetRegView ${OTHER_BITNESS}
> + ReadRegStr $R1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
> + ReadRegStr $R2 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
> + SetRegView lastused
> +
> + ${If} $R1 == ""
> + Quit
> + ${EndIf}
> +
> + ; Run uninstaller
> + HideWindow
> + ClearErrors
> + ExecWait '"$R1" _?=$R2'
> +
> + ; If uninstall was not successfull, do not continue.
> + ; This happens for example if the user cancels the uninstaller.
> + ${If} ${Errors}
> + Quit
> + ${EndIf}
> +
> + ${If} ${FileExists} "$R1"
> + Delete "$R1"
> + RMDir "$R2"
> + ${EndIf}
> +
> + ; Cleanup the previous version variable!
> + StrCpy $PreviousVersion ""
> + ${EndIf}
> +
> +
> ; See if previous version exists
> Call ReadPreviousVersion
>
More information about the vlc-devel
mailing list