Changed main registry entry (LyX\Version now).

Added "latestVersion" value.

Patch from Eugene.
This commit is contained in:
Richard Kimberly Heck 2020-04-04 19:18:23 -04:00
parent 933cf12140
commit bd660c459f
4 changed files with 28 additions and 8 deletions

View File

@ -59,7 +59,8 @@ Configuration of LyX installer
!define BIN_LYX "${APP_NAME}.exe" !define BIN_LYX "${APP_NAME}.exe"
!define APP_RUN "bin\${BIN_LYX}" !define APP_RUN "bin\${BIN_LYX}"
!define APP_REGKEY "Software\${APP_NAME}${APP_SERIES_KEY}" # like "LyX220" !define APP_REGFOLDER "Software\${APP_NAME}"
!define APP_REGKEY "${APP_REGFOLDER}\${APP_SERIES_KEY}" # like "LyX\220"
!define APP_REGKEY_SETUP "${APP_REGKEY}\Setup" !define APP_REGKEY_SETUP "${APP_REGKEY}\Setup"
!define APP_REGKEY_SETTINGS "${APP_REGKEY}\Settings" !define APP_REGKEY_SETTINGS "${APP_REGKEY}\Settings"

View File

@ -13,8 +13,8 @@ Var LyXLangName
# COMPONENT can be LaTeX, ImageMagick and Ghostscript # COMPONENT can be LaTeX, ImageMagick and Ghostscript
!macro EXTERNAL_INIT COMPONENT !macro EXTERNAL_INIT COMPONENT
# APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup" # APP_REGKEY_SETUP = "Software\${APP_NAME}\${APP_SERIES_KEY}\Setup"
# where ${APP_NAME}${APP_SERIES_KEY} is something like LyX22 # where ${APP_NAME}\${APP_SERIES_KEY} is something like LyX\220
ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path" ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
# BIN_LATEX etc are defined in settings.nsh # BIN_LATEX etc are defined in settings.nsh

View File

@ -16,6 +16,10 @@ Var PathPrefix
Section -InstallData Section -InstallData
# Registry information # Registry information
ReadRegStr $0 SHCTX ${APP_REGFOLDER} "latestVersion"
${If} $0 < ${APP_SERIES_KEY}
WriteRegStr SHCTX ${APP_REGFOLDER} "latestVersion" ${APP_SERIES_KEY}
${EndIf}
WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR
WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}" WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
WriteRegStr SHCTX ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX WriteRegStr SHCTX ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX
@ -54,16 +58,15 @@ Section -InstallData
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder" WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
# if we install over an older existing version, remove the old uninstaller information # if we install over an older existing version, remove the old uninstaller information
${if} $OldVersionNumber < ${APP_SERIES_KEY} ${if} $OldVersionNumber != ""
${AndIf} $OldVersionNumber < ${APP_SERIES_KEY}
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber" DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}$OldVersionNumber" DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}\$OldVersionNumber"
# also delete in the case of an emergency release # also delete in the case of an emergency release
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1" DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1"
DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}$OldVersionNumber1" DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}\$OldVersionNumber1"
${endif} ${endif}
SectionEnd SectionEnd
#-------------------------------- #--------------------------------

View File

@ -69,12 +69,28 @@ Section "un.LyX" un.SecUnProgramFiles
RMDir /r "$INSTDIR" RMDir /r "$INSTDIR"
# Registry keys and values # Registry keys and values
DeleteRegValue SHCTX "subkey" "key_name"
DeleteRegKey SHCTX "${APP_REGKEY_SETUP}" DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
DeleteRegKey SHCTX "${APP_REGKEY}" DeleteRegKey SHCTX "${APP_REGKEY}"
DeleteRegKey SHCTX "${APP_UNINST_KEY}" DeleteRegKey SHCTX "${APP_UNINST_KEY}"
DeleteRegKey HKCR "Applications\${BIN_LYX}" DeleteRegKey HKCR "Applications\${BIN_LYX}"
DeleteRegValue HKCR "${APP_NAME}.Document\Shell\open\command" "" DeleteRegValue HKCR "${APP_NAME}.Document\Shell\open\command" ""
DeleteRegValue HKCR "${APP_NAME}.Document\DefaultIcon" "" DeleteRegValue HKCR "${APP_NAME}.Document\DefaultIcon" ""
ReadRegStr $0 SHCTX ${APP_REGFOLDER} "latestVersion"
${If} $0 == ${APP_SERIES_KEY}
DeleteRegValue SHCTX ${APP_REGFOLDER} "latestVersion"
StrCpy $0 0
StrCpy $R0 ""
${Do}
StrCpy $R1 $R0
EnumRegKey $R0 SHCTX ${APP_REGFOLDER} $0
IntOp $0 $0 + 1
${LoopUntil} $R0 == ""
${If} $R1 != ""
WriteRegStr SHCTX ${APP_REGFOLDER} "latestVersion" $R1
${EndIf}
${EndIf}
DeleteRegKey /ifempty SHCTX ${APP_REGFOLDER}
# File associations # File associations
ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" "" ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""