Added UnpinShortcut and NotifyShell_AssocChanged macros
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7183 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
ea50284c18
commit
3c47165946
6 changed files with 63 additions and 16 deletions
|
@ -16,6 +16,8 @@ Released on ? ?th, 2020
|
||||||
|
|
||||||
\b Added \R{getknownfolderpath}{GetKnownFolderPath}
|
\b Added \R{getknownfolderpath}{GetKnownFolderPath}
|
||||||
|
|
||||||
|
\b Added UnpinShortcut macro (Integration.nsh)
|
||||||
|
|
||||||
\S2{} Minor Changes
|
\S2{} Minor Changes
|
||||||
|
|
||||||
\b Added \R{ifshellvarcontextall}{IfShellVarContextAll} and \R{ifrtllanguage}{IfRtlLanguage}
|
\b Added \R{ifshellvarcontextall}{IfShellVarContextAll} and \R{ifrtllanguage}{IfRtlLanguage}
|
||||||
|
|
|
@ -22,6 +22,7 @@ InstallDirRegKey HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
||||||
|
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
!include WinCore.nsh
|
!include WinCore.nsh
|
||||||
|
!include Integration.nsh
|
||||||
|
|
||||||
|
|
||||||
Page Directory
|
Page Directory
|
||||||
|
@ -103,7 +104,7 @@ Section -ShellAssoc
|
||||||
WriteRegStr ShCtx "Software\RegisteredApplications" "Nullsoft Test App" "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities"
|
WriteRegStr ShCtx "Software\RegisteredApplications" "Nullsoft Test App" "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
System::Call 'SHELL32::SHChangeNotify(i0x08000000, i0, p0, p0)' ; Notify the shell with SHCNE_ASSOCCHANGED
|
${NotifyShell_AssocChanged}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,14 +154,15 @@ Section -un.ShellAssoc
|
||||||
;DeleteRegKey HKCU "Software\Microsoft\Windows\Roaming\OpenWith\FileExts\${ASSOC_EXT}"
|
;DeleteRegKey HKCU "Software\Microsoft\Windows\Roaming\OpenWith\FileExts\${ASSOC_EXT}"
|
||||||
;DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\${ASSOC_EXT}"
|
;DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\${ASSOC_EXT}"
|
||||||
|
|
||||||
System::Call 'SHELL32::SHChangeNotify(i0x08000000, i0, p0, p0)' ; Notify the shell with SHCNE_ASSOCCHANGED
|
${NotifyShell_AssocChanged}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section -Uninstall
|
Section -Uninstall
|
||||||
|
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
|
||||||
|
Delete "$SMPrograms\${NAME}.lnk"
|
||||||
|
|
||||||
Delete "$InstDir\MyApp.exe"
|
Delete "$InstDir\MyApp.exe"
|
||||||
Delete "$InstDir\Uninst.exe"
|
Delete "$InstDir\Uninst.exe"
|
||||||
RMDir "$InstDir"
|
RMDir "$InstDir"
|
||||||
DeleteRegKey HKCU "${REGPATH_UNINSTSUBKEY}"
|
DeleteRegKey HKCU "${REGPATH_UNINSTSUBKEY}"
|
||||||
|
|
||||||
Delete "$SMPrograms\${NAME}.lnk"
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
|
@ -21,14 +21,15 @@ RequestExecutionLevel Admin ; Request admin rights on WinVista+ (when UAC is tur
|
||||||
InstallDir "$ProgramFiles\$(^Name)"
|
InstallDir "$ProgramFiles\$(^Name)"
|
||||||
InstallDirRegKey HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
InstallDirRegKey HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
||||||
|
|
||||||
|
!include LogicLib.nsh
|
||||||
|
!include Integration.nsh
|
||||||
|
|
||||||
Page Directory
|
Page Directory
|
||||||
Page InstFiles
|
Page InstFiles
|
||||||
|
|
||||||
Uninstpage UninstConfirm
|
Uninstpage UninstConfirm
|
||||||
Uninstpage InstFiles
|
Uninstpage InstFiles
|
||||||
|
|
||||||
!include LogicLib.nsh
|
|
||||||
|
|
||||||
!macro EnsureAdminRights
|
!macro EnsureAdminRights
|
||||||
UserInfo::GetAccountType
|
UserInfo::GetAccountType
|
||||||
Pop $0
|
Pop $0
|
||||||
|
@ -70,10 +71,11 @@ SectionEnd
|
||||||
|
|
||||||
|
|
||||||
Section -Uninstall
|
Section -Uninstall
|
||||||
|
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
|
||||||
|
Delete "$SMPrograms\${NAME}.lnk"
|
||||||
|
|
||||||
Delete "$InstDir\MyApp.exe"
|
Delete "$InstDir\MyApp.exe"
|
||||||
Delete "$InstDir\Uninst.exe"
|
Delete "$InstDir\Uninst.exe"
|
||||||
RMDir "$InstDir"
|
RMDir "$InstDir"
|
||||||
DeleteRegKey HKLM "${REGPATH_UNINSTSUBKEY}"
|
DeleteRegKey HKLM "${REGPATH_UNINSTSUBKEY}"
|
||||||
|
|
||||||
Delete "$SMPrograms\${NAME}.lnk"
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
|
@ -49,12 +49,7 @@ RequestExecutionLevel admin
|
||||||
!include "Memento.nsh"
|
!include "Memento.nsh"
|
||||||
!include "WordFunc.nsh"
|
!include "WordFunc.nsh"
|
||||||
!include "Util.nsh"
|
!include "Util.nsh"
|
||||||
|
!include "Integration.nsh"
|
||||||
;--------------------------------
|
|
||||||
;Definitions
|
|
||||||
|
|
||||||
!define SHCNE_ASSOCCHANGED 0x8000000
|
|
||||||
!define SHCNF_IDLIST 0
|
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Configuration
|
;Configuration
|
||||||
|
@ -213,6 +208,7 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
|
||||||
File ..\Include\MultiUser.nsh
|
File ..\Include\MultiUser.nsh
|
||||||
File ..\Include\VB6RunTime.nsh
|
File ..\Include\VB6RunTime.nsh
|
||||||
File ..\Include\Util.nsh
|
File ..\Include\Util.nsh
|
||||||
|
File ..\Include\Integration.nsh
|
||||||
File ..\Include\WinCore.nsh
|
File ..\Include\WinCore.nsh
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Include\Win
|
SetOutPath $INSTDIR\Include\Win
|
||||||
|
@ -296,7 +292,7 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
|
||||||
WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"'
|
WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"'
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p0, p0)'
|
${NotifyShell_AssocChanged}
|
||||||
|
|
||||||
${MementoSectionEnd}
|
${MementoSectionEnd}
|
||||||
|
|
||||||
|
@ -1071,7 +1067,7 @@ Section Uninstall
|
||||||
!insertmacro AssocDeleteFileExtAndProgId HKLM ".nsi" "NSIS.Script"
|
!insertmacro AssocDeleteFileExtAndProgId HKLM ".nsi" "NSIS.Script"
|
||||||
!insertmacro AssocDeleteFileExtAndProgId HKLM ".nsh" "NSIS.Header"
|
!insertmacro AssocDeleteFileExtAndProgId HKLM ".nsh" "NSIS.Header"
|
||||||
|
|
||||||
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p0, p0)'
|
${NotifyShell_AssocChanged}
|
||||||
|
|
||||||
DeleteRegKey HKLM "${REG_UNINST_KEY}"
|
DeleteRegKey HKLM "${REG_UNINST_KEY}"
|
||||||
DeleteRegKey HKLM "Software\NSIS"
|
DeleteRegKey HKLM "Software\NSIS"
|
||||||
|
|
44
Include/Integration.nsh
Normal file
44
Include/Integration.nsh
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
!verbose push 3
|
||||||
|
!ifndef INTEGRATION_INCLUDED
|
||||||
|
!define INTEGRATION_INCLUDED 1
|
||||||
|
|
||||||
|
!include "Util.nsh"
|
||||||
|
|
||||||
|
|
||||||
|
!define NotifyShell_AssocChanged `System::Call 'SHELL32::SHChangeNotify(i0x8000000,i0,p0,p0)'` ; Notify the shell with SHCNE_ASSOCCHANGED
|
||||||
|
|
||||||
|
|
||||||
|
!define UnpinShortcut "!insertmacro UnpinShortcut "
|
||||||
|
!macro UnpinShortcut lnkpath
|
||||||
|
Push "${lnkpath}"
|
||||||
|
${CallArtificialFunction} UnpinShortcut_Implementation
|
||||||
|
!macroend
|
||||||
|
!macro UnpinShortcut_Implementation
|
||||||
|
!include "LogicLib.nsh"
|
||||||
|
!include "Win\COM.nsh"
|
||||||
|
Exch $0
|
||||||
|
Push $1
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r1 ""
|
||||||
|
${If} $1 P<> 0
|
||||||
|
System::Call 'SHELL32::SHCreateItemFromParsingName(wr0,p0,g"${IID_IShellItem}",*p0r0)'
|
||||||
|
${If} $0 P<> 0
|
||||||
|
${IStartMenuPinnedList::RemoveFromList} $1 '(r0)'
|
||||||
|
${IUnknown::Release} $0 ""
|
||||||
|
${EndIf}
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
!ifdef NSIS_IX86 | NSIS_AMD64
|
||||||
|
${Else}
|
||||||
|
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} "{ec35e37a-6579-4f3c-93cd-6e62c4ef7636}" r1 ""
|
||||||
|
${If} $1 P<> 0
|
||||||
|
ExecShellWait /INVOKEIDLIST "unpin" $0 ; WinXP
|
||||||
|
${IUnknown::Release} $1 ""
|
||||||
|
${EndIf}
|
||||||
|
!endif
|
||||||
|
${EndIf}
|
||||||
|
Pop $1
|
||||||
|
Pop $0
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!endif #!INCLUDED
|
||||||
|
!verbose pop
|
|
@ -1,6 +1,7 @@
|
||||||
includes = Split("""
|
includes = Split("""
|
||||||
Colors.nsh
|
Colors.nsh
|
||||||
FileFunc.nsh
|
FileFunc.nsh
|
||||||
|
Integration.nsh
|
||||||
LangFile.nsh
|
LangFile.nsh
|
||||||
Library.nsh
|
Library.nsh
|
||||||
LogicLib.nsh
|
LogicLib.nsh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue