Function RetrieveSMState # Custom function, called after the Startmenu page has been created
${IfNot} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
Return # Not over-installing
+ ${Else}
+ ${GetFileVersion} "$INSTDIR\Uninstall-LyX.exe" $0
+ StrCpy $0 $0 3 # get only the first 3 chars, e.g. "2.3"
+ ${If} $0 != "${VERSION_MAJOR}.${VERSION_MINOR}"
+ Return # Installing over a wrong version
+ ${EndIf}
${EndIf}
Call PrepareShellCTX # Helper function from above
StrCpy $StartMenuFolder ">$StartMenuFolder"
${Else}
GetDlgItem $0 $mui.StartMenuPage 1005 # Get the HWND of the checkbox, MUI2 does not provide variable for that
- SendMessage $0 ${BM_CLICK} 0 0 # NSIS delivers no other possibility here other than to send a click event to the checkbox
+ ${NSD_GetState} $0 $1
+ ${If} $1 = ${BST_UNCHECKED}
+ SendMessage $0 ${BM_CLICK} 0 0 # NSIS delivers no other possibility here other than to send a click event to the checkbox
+ ${EndIf}
${EndIf}
${EndIf}
FunctionEnd
Call DefaultDesktopFileAssoc
SectionEnd
+Section -UninstallOld
+ ${If} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
+ ${GetFileVersion} "$INSTDIR\Uninstall-LyX.exe" $0
+ StrCpy $0 $0 3 # get only the first 3 chars, e.g. "2.3"
+ ${If} $0 != "${VERSION_MAJOR}.${VERSION_MINOR}"
+ ExecWait "$INSTDIR\Uninstall-LyX.exe /S _?=$INSTDIR" # silently uninstall old LyX
+ Delete "$INSTDIR\Uninstall-LyX.exe"
+ ${EndIf}
+ ${EndIf}
+SectionEnd
+
Section -OverInstallReg # If over-installing, we need to delete the registry keys written by the previous installment
Call PrepareShellCTX # Helper function from above
StrCpy $1 0
# Visual C++ redistributable (if native build)
File "${FILES_DEPS}\bin\concrt140.dll"
File "${FILES_DEPS}\bin\msvcp140.dll"
+ File "${FILES_DEPS}\bin\msvcp140_1.dll"
File "${FILES_DEPS}\bin\vcamp140.dll"
File "${FILES_DEPS}\bin\vccorlib140.dll"
File "${FILES_DEPS}\bin\vcomp140.dll"
${IfNot} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
Return # Not over-installing
+ ${Else}
+ ${GetFileVersion} "$INSTDIR\Uninstall-LyX.exe" $0
+ StrCpy $0 $0 3 # get only the first 3 chars, e.g. "2.3"
+ ${If} $0 != "${VERSION_MAJOR}.${VERSION_MINOR}"
+ Return # Installing over a wrong version
+ ${EndIf}
${EndIf}
Call PrepareShellCTX