From 63b31ddda616d10334dd31842b0cf790bdeedbb2 Mon Sep 17 00:00:00 2001 From: Cyano Hao Date: Thu, 28 Mar 2024 14:54:17 +0800 Subject: [PATCH] use consistent context in installer (#333) --- .../redpanda-i686-nocompiler.nsi | 49 +++++++++--------- .../installer-scripts/redpanda-i686.nsi | 51 ++++++++++--------- .../installer-scripts/redpanda-nocompiler.nsi | 48 +++++++++-------- .../installer-scripts/redpanda-x64.nsi | 50 +++++++++--------- 4 files changed, 97 insertions(+), 101 deletions(-) diff --git a/platform/windows/installer-scripts/redpanda-i686-nocompiler.nsi b/platform/windows/installer-scripts/redpanda-i686-nocompiler.nsi index 42a562f4..e9510624 100644 --- a/platform/windows/installer-scripts/redpanda-i686-nocompiler.nsi +++ b/platform/windows/installer-scripts/redpanda-i686-nocompiler.nsi @@ -40,7 +40,7 @@ InstType "Minimal";2 InstType "Safe";3 ## Remember the installer language -!define MUI_LANGDLL_REGISTRY_ROOT "HKLM" +!define MUI_LANGDLL_REGISTRY_ROOT "ShCtx" !define MUI_LANGDLL_REGISTRY_KEY "Software\RedPanda-C++" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" @@ -77,14 +77,13 @@ Section "$(SectionMainName)" SectionMain SetOutPath $INSTDIR - SetRegView 64 ; Allways create an uninstaller WriteUninstaller "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" ; Write required files @@ -226,9 +225,7 @@ SubSection "$(SectionShortcutsName)" SectionShortcuts Section "$(SectionMenuLaunchName)" SectionMenuLaunch SectionIn 1 3 - - ; always use all user start menu, normal users can delete these - SetShellVarContext all + StrCpy $0 $SMPROGRAMS ; start menu Programs folder CreateDirectory "$0\$(MessageAppName)" CreateShortCut "$0\$(MessageAppName)\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" @@ -238,9 +235,7 @@ SectionEnd Section "$(SectionDesktopLaunchName)" SectionDesktopLaunch SectionIn 1 3 - - ; always use current user desktop, normal users can't delete all users' shortcuts - SetShellVarContext current + CreateShortCut "$DESKTOP\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" SectionEnd @@ -274,6 +269,8 @@ Function .onInit IfFileExists "$APPDATA\Dev-Cpp\devcpp.cfg" 0 +2 # deprecated config file SectionSetFlags ${SectionConfig} ${SF_SELECTED} + SetShellVarContext all + SetRegView 32 FunctionEnd Function myGuiInit @@ -283,6 +280,7 @@ Function myGuiInit Call UninstallExisting SetRegView 64 Call UninstallExisting + SetRegView 32 FunctionEnd @@ -291,7 +289,7 @@ Function BackupAssoc ;$0 is an extension - for example ".dev" ;check if backup already exists - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" ;don't backup if backup exists in registry StrCmp $1 "" 0 no_assoc @@ -300,13 +298,16 @@ Function BackupAssoc StrCmp $1 "DevCpp$0" no_assoc StrCmp $1 "" no_assoc - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" no_assoc: FunctionEnd Function un.onInit - !insertmacro MUI_UNGETLANGUAGE + !insertmacro MUI_UNGETLANGUAGE + + SetShellVarContext all + SetRegView 32 FunctionEnd ;restore file association @@ -314,7 +315,7 @@ Function un.RestoreAssoc ;$0 is an extension - for example ".dev" DeleteRegKey HKCR "$0" - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" StrCmp $1 "" no_backup WriteRegStr HKCR "$0" "" "$1" Call un.RefreshShellIcons @@ -383,7 +384,7 @@ Function GetParent FunctionEnd Function UninstallExisting - ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" + ReadRegStr $R0 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" StrCmp $R0 "" done @@ -418,15 +419,13 @@ Section "Uninstall" ; Remove uninstaller Delete "$INSTDIR\uninstall.exe" - ; Remove start menu stuff, located in all users folder - SetShellVarContext all + ; Remove start menu stuff Delete "$SMPROGRAMS\$(MessageAppName)\$(MessageAppName).lnk" Delete "$SMPROGRAMS\$(MessageAppName)\License.lnk" Delete "$SMPROGRAMS\$(MessageAppName)\Uninstall $(MessageAppName).lnk" RMDir "$SMPROGRAMS\$(MessageAppName)" - ; Remove desktop stuff, located in current user folder - SetShellVarContext current + ; Remove desktop stuff Delete "$QUICKLAUNCH\$(MessageAppName).lnk" Delete "$DESKTOP\$(MessageAppName).lnk" @@ -471,8 +470,8 @@ Section "Uninstall" Call un.DeleteDirIfEmpty ; Remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" - DeleteRegKey HKCU "Software\RedPanda-C++" + DeleteRegKey ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" + DeleteRegKey ShCtx "Software\RedPanda-C++" IfSilent +2 ; Don't ask when running in silent mode MessageBox MB_YESNO "$(MessageRemoveConfig)" IDNO Done @@ -480,4 +479,4 @@ Section "Uninstall" RMDir /r "$APPDATA\RedPandaIDE" Done: -SectionEnd \ No newline at end of file +SectionEnd diff --git a/platform/windows/installer-scripts/redpanda-i686.nsi b/platform/windows/installer-scripts/redpanda-i686.nsi index 6a5c3ad1..ef2e04ba 100644 --- a/platform/windows/installer-scripts/redpanda-i686.nsi +++ b/platform/windows/installer-scripts/redpanda-i686.nsi @@ -41,7 +41,7 @@ InstType "Minimal";2 InstType "Safe";3 ## Remember the installer language -!define MUI_LANGDLL_REGISTRY_ROOT "HKLM" +!define MUI_LANGDLL_REGISTRY_ROOT "ShCtx" !define MUI_LANGDLL_REGISTRY_KEY "Software\RedPanda-C++" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" @@ -78,14 +78,13 @@ Section "$(SectionMainName)" SectionMain SetOutPath $INSTDIR - SetRegView 32 ; Allways create an uninstaller WriteUninstaller "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" ; Write required files @@ -234,9 +233,7 @@ SubSection "$(SectionShortcutsName)" SectionShortcuts Section "$(SectionMenuLaunchName)" SectionMenuLaunch SectionIn 1 3 - - ; always use all user start menu, normal users can delete these - SetShellVarContext all + StrCpy $0 $SMPROGRAMS ; start menu Programs folder CreateDirectory "$0\$(MessageAppName)" CreateShortCut "$0\$(MessageAppName)\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" @@ -246,9 +243,7 @@ SectionEnd Section "$(SectionDesktopLaunchName)" SectionDesktopLaunch SectionIn 1 3 - - ; always use current user desktop, normal users can't delete all users' shortcuts - SetShellVarContext current + CreateShortCut "$DESKTOP\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" SectionEnd @@ -283,6 +278,8 @@ Function .onInit IfFileExists "$APPDATA\Dev-Cpp\devcpp.cfg" 0 +2 # deprecated config file SectionSetFlags ${SectionConfig} ${SF_SELECTED} + SetShellVarContext all + SetRegView 32 FunctionEnd Function myGuiInit @@ -290,6 +287,9 @@ Function myGuiInit ; uninstall existing SetRegView 32 Call UninstallExisting + SetRegView 64 + Call UninstallExisting + SetRegView 32 FunctionEnd @@ -298,7 +298,7 @@ Function BackupAssoc ;$0 is an extension - for example ".dev" ;check if backup already exists - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" ;don't backup if backup exists in registry StrCmp $1 "" 0 no_assoc @@ -307,13 +307,16 @@ Function BackupAssoc StrCmp $1 "DevCpp$0" no_assoc StrCmp $1 "" no_assoc - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" no_assoc: FunctionEnd Function un.onInit - !insertmacro MUI_UNGETLANGUAGE + !insertmacro MUI_UNGETLANGUAGE + + SetShellVarContext all + SetRegView 32 FunctionEnd ;restore file association @@ -321,7 +324,7 @@ Function un.RestoreAssoc ;$0 is an extension - for example ".dev" DeleteRegKey HKCR "$0" - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" StrCmp $1 "" no_backup WriteRegStr HKCR "$0" "" "$1" Call un.RefreshShellIcons @@ -390,7 +393,7 @@ Function GetParent FunctionEnd Function UninstallExisting - ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" + ReadRegStr $R0 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" StrCmp $R0 "" done @@ -425,15 +428,13 @@ Section "Uninstall" ; Remove uninstaller Delete "$INSTDIR\uninstall.exe" - ; Remove start menu stuff, located in all users folder - SetShellVarContext all + ; Remove start menu stuff Delete "$SMPROGRAMS\$(MessageAppName)\$(MessageAppName).lnk" Delete "$SMPROGRAMS\$(MessageAppName)\License.lnk" Delete "$SMPROGRAMS\$(MessageAppName)\Uninstall $(MessageAppName).lnk" RMDir "$SMPROGRAMS\$(MessageAppName)" - ; Remove desktop stuff, located in current user folder - SetShellVarContext current + ; Remove desktop stuff Delete "$QUICKLAUNCH\$(MessageAppName).lnk" Delete "$DESKTOP\$(MessageAppName).lnk" @@ -479,8 +480,8 @@ Section "Uninstall" Call un.DeleteDirIfEmpty ; Remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" - DeleteRegKey HKCU "Software\RedPanda-C++" + DeleteRegKey ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" + DeleteRegKey ShCtx "Software\RedPanda-C++" IfSilent +2 ; Don't ask when running in silent mode MessageBox MB_YESNO "$(MessageRemoveConfig)" IDNO Done @@ -488,4 +489,4 @@ Section "Uninstall" RMDir /r "$APPDATA\RedPandaIDE" Done: -SectionEnd \ No newline at end of file +SectionEnd diff --git a/platform/windows/installer-scripts/redpanda-nocompiler.nsi b/platform/windows/installer-scripts/redpanda-nocompiler.nsi index 0992aefb..46a4e797 100644 --- a/platform/windows/installer-scripts/redpanda-nocompiler.nsi +++ b/platform/windows/installer-scripts/redpanda-nocompiler.nsi @@ -40,7 +40,7 @@ InstType "Minimal";2 InstType "Safe";3 ## Remember the installer language -!define MUI_LANGDLL_REGISTRY_ROOT "HKLM" +!define MUI_LANGDLL_REGISTRY_ROOT "ShCtx" !define MUI_LANGDLL_REGISTRY_KEY "Software\RedPanda-C++" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" @@ -77,14 +77,13 @@ Section "$(SectionMainName)" SectionMain SetOutPath $INSTDIR - SetRegView 64 ; Allways create an uninstaller WriteUninstaller "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" ; Write required files @@ -226,9 +225,7 @@ SubSection "$(SectionShortcutsName)" SectionShortcuts Section "$(SectionMenuLaunchName)" SectionMenuLaunch SectionIn 1 3 - - ; always use all user start menu, normal users can delete these - SetShellVarContext all + StrCpy $0 $SMPROGRAMS ; start menu Programs folder CreateDirectory "$0\$(MessageAppName)" CreateShortCut "$0\$(MessageAppName)\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" @@ -238,9 +235,7 @@ SectionEnd Section "$(SectionDesktopLaunchName)" SectionDesktopLaunch SectionIn 1 3 - - ; always use current user desktop, normal users can't delete all users' shortcuts - SetShellVarContext current + CreateShortCut "$DESKTOP\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" SectionEnd @@ -274,6 +269,8 @@ Function .onInit IfFileExists "$APPDATA\Dev-Cpp\devcpp.cfg" 0 +2 # deprecated config file SectionSetFlags ${SectionConfig} ${SF_SELECTED} + SetShellVarContext all + SetRegView 64 FunctionEnd Function myGuiInit @@ -291,7 +288,7 @@ Function BackupAssoc ;$0 is an extension - for example ".dev" ;check if backup already exists - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" ;don't backup if backup exists in registry StrCmp $1 "" 0 no_assoc @@ -300,13 +297,16 @@ Function BackupAssoc StrCmp $1 "DevCpp$0" no_assoc StrCmp $1 "" no_assoc - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" no_assoc: FunctionEnd Function un.onInit - !insertmacro MUI_UNGETLANGUAGE + !insertmacro MUI_UNGETLANGUAGE + + SetShellVarContext all + SetRegView 64 FunctionEnd ;restore file association @@ -314,7 +314,7 @@ Function un.RestoreAssoc ;$0 is an extension - for example ".dev" DeleteRegKey HKCR "$0" - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" StrCmp $1 "" no_backup WriteRegStr HKCR "$0" "" "$1" Call un.RefreshShellIcons @@ -383,7 +383,7 @@ Function GetParent FunctionEnd Function UninstallExisting - ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" + ReadRegStr $R0 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" StrCmp $R0 "" done @@ -418,15 +418,13 @@ Section "Uninstall" ; Remove uninstaller Delete "$INSTDIR\uninstall.exe" - ; Remove start menu stuff, located in all users folder - SetShellVarContext all + ; Remove start menu stuff Delete "$SMPROGRAMS\$(MessageAppName)\$(MessageAppName).lnk" Delete "$SMPROGRAMS\$(MessageAppName)\License.lnk" Delete "$SMPROGRAMS\$(MessageAppName)\Uninstall $(MessageAppName).lnk" RMDir "$SMPROGRAMS\$(MessageAppName)" - ; Remove desktop stuff, located in current user folder - SetShellVarContext current + ; Remove desktop stuff Delete "$QUICKLAUNCH\$(MessageAppName).lnk" Delete "$DESKTOP\$(MessageAppName).lnk" @@ -471,8 +469,8 @@ Section "Uninstall" Call un.DeleteDirIfEmpty ; Remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" - DeleteRegKey HKCU "Software\RedPanda-C++" + DeleteRegKey ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" + DeleteRegKey ShCtx "Software\RedPanda-C++" IfSilent +2 ; Don't ask when running in silent mode MessageBox MB_YESNO "$(MessageRemoveConfig)" IDNO Done @@ -480,4 +478,4 @@ Section "Uninstall" RMDir /r "$APPDATA\RedPandaIDE" Done: -SectionEnd \ No newline at end of file +SectionEnd diff --git a/platform/windows/installer-scripts/redpanda-x64.nsi b/platform/windows/installer-scripts/redpanda-x64.nsi index 025d4ef6..19e03b90 100644 --- a/platform/windows/installer-scripts/redpanda-x64.nsi +++ b/platform/windows/installer-scripts/redpanda-x64.nsi @@ -41,7 +41,7 @@ InstType "Minimal";2 InstType "Safe";3 ## Remember the installer language -!define MUI_LANGDLL_REGISTRY_ROOT "HKLM" +!define MUI_LANGDLL_REGISTRY_ROOT "ShCtx" !define MUI_LANGDLL_REGISTRY_KEY "Software\RedPanda-C++" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" @@ -78,14 +78,13 @@ Section "$(SectionMainName)" SectionMain SetOutPath $INSTDIR - SetRegView 64 ; Allways create an uninstaller WriteUninstaller "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Redpanda-C++" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${DEVCPP_VERSION}" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu(royqh1979@gmail.com)" ; Write required files @@ -234,9 +233,7 @@ SubSection "$(SectionShortcutsName)" SectionShortcuts Section "$(SectionMenuLaunchName)" SectionMenuLaunch SectionIn 1 3 - - ; always use all user start menu, normal users can delete these - SetShellVarContext all + StrCpy $0 $SMPROGRAMS ; start menu Programs folder CreateDirectory "$0\$(MessageAppName)" CreateShortCut "$0\$(MessageAppName)\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" @@ -246,9 +243,7 @@ SectionEnd Section "$(SectionDesktopLaunchName)" SectionDesktopLaunch SectionIn 1 3 - - ; always use current user desktop, normal users can't delete all users' shortcuts - SetShellVarContext current + CreateShortCut "$DESKTOP\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe" SectionEnd @@ -283,6 +278,8 @@ Function .onInit IfFileExists "$APPDATA\Dev-Cpp\devcpp.cfg" 0 +2 # deprecated config file SectionSetFlags ${SectionConfig} ${SF_SELECTED} + SetShellVarContext all + SetRegView 64 FunctionEnd Function myGuiInit @@ -300,7 +297,7 @@ Function BackupAssoc ;$0 is an extension - for example ".dev" ;check if backup already exists - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" ;don't backup if backup exists in registry StrCmp $1 "" 0 no_assoc @@ -309,13 +306,16 @@ Function BackupAssoc StrCmp $1 "DevCpp$0" no_assoc StrCmp $1 "" no_assoc - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" + WriteRegStr ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" "$1" no_assoc: FunctionEnd Function un.onInit - !insertmacro MUI_UNGETLANGUAGE + !insertmacro MUI_UNGETLANGUAGE + + SetShellVarContext all + SetRegView 64 FunctionEnd ;restore file association @@ -323,7 +323,7 @@ Function un.RestoreAssoc ;$0 is an extension - for example ".dev" DeleteRegKey HKCR "$0" - ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" + ReadRegStr $1 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++\Backup" "$0" StrCmp $1 "" no_backup WriteRegStr HKCR "$0" "" "$1" Call un.RefreshShellIcons @@ -392,7 +392,7 @@ Function GetParent FunctionEnd Function UninstallExisting - ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" + ReadRegStr $R0 ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" StrCmp $R0 "" done @@ -427,15 +427,13 @@ Section "Uninstall" ; Remove uninstaller Delete "$INSTDIR\uninstall.exe" - ; Remove start menu stuff, located in all users folder - SetShellVarContext all + ; Remove start menu stuff Delete "$SMPROGRAMS\$(MessageAppName)\$(MessageAppName).lnk" Delete "$SMPROGRAMS\$(MessageAppName)\License.lnk" Delete "$SMPROGRAMS\$(MessageAppName)\Uninstall $(MessageAppName).lnk" RMDir "$SMPROGRAMS\$(MessageAppName)" - - ; Remove desktop stuff, located in current user folder - SetShellVarContext current + + ; Remove desktop stuff Delete "$QUICKLAUNCH\$(MessageAppName).lnk" Delete "$DESKTOP\$(MessageAppName).lnk" @@ -480,8 +478,8 @@ Section "Uninstall" Call un.DeleteDirIfEmpty ; Remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" - DeleteRegKey HKCU "Software\RedPanda-C++" + DeleteRegKey ShCtx "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" + DeleteRegKey ShCtx "Software\RedPanda-C++" IfSilent +2 ; Don't ask when running in silent mode MessageBox MB_YESNO "$(MessageRemoveConfig)" IDNO Done @@ -489,4 +487,4 @@ Section "Uninstall" RMDir /r "$APPDATA\RedPandaIDE" Done: -SectionEnd \ No newline at end of file +SectionEnd