fix eol
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7199 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
da1f2ae86e
commit
fe5b26b4b5
2 changed files with 249 additions and 249 deletions
|
@ -1,168 +1,168 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
This example script installs a simple application for a single user.
|
This example script installs a simple application for a single user.
|
||||||
|
|
||||||
If multiple users on the same machine run this installer, each user
|
If multiple users on the same machine run this installer, each user
|
||||||
will end up with a separate install that is not affected by
|
will end up with a separate install that is not affected by
|
||||||
update/removal operations performed by other users.
|
update/removal operations performed by other users.
|
||||||
|
|
||||||
Per-user installers should only write to HKCU and
|
Per-user installers should only write to HKCU and
|
||||||
folders inside the users profile.
|
folders inside the users profile.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
!define NAME "Per-User example"
|
!define NAME "Per-User example"
|
||||||
!define REGPATH_UNINSTSUBKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
|
!define REGPATH_UNINSTSUBKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
|
||||||
Name "${NAME}"
|
Name "${NAME}"
|
||||||
OutFile "Install ${NAME}.exe"
|
OutFile "Install ${NAME}.exe"
|
||||||
Unicode True
|
Unicode True
|
||||||
RequestExecutionLevel User ; We don't need UAC elevation
|
RequestExecutionLevel User ; We don't need UAC elevation
|
||||||
InstallDir "" ; Don't set a default $InstDir so we can detect /D= and InstallDirRegKey
|
InstallDir "" ; Don't set a default $InstDir so we can detect /D= and InstallDirRegKey
|
||||||
InstallDirRegKey HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
InstallDirRegKey HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
||||||
|
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
!include WinCore.nsh
|
!include WinCore.nsh
|
||||||
!include Integration.nsh
|
!include Integration.nsh
|
||||||
|
|
||||||
|
|
||||||
Page Directory
|
Page Directory
|
||||||
Page InstFiles
|
Page InstFiles
|
||||||
|
|
||||||
Uninstpage UninstConfirm
|
Uninstpage UninstConfirm
|
||||||
Uninstpage InstFiles
|
Uninstpage InstFiles
|
||||||
|
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
SetShellVarContext Current
|
SetShellVarContext Current
|
||||||
|
|
||||||
${If} $InstDir == "" ; No /D= nor InstallDirRegKey?
|
${If} $InstDir == "" ; No /D= nor InstallDirRegKey?
|
||||||
GetKnownFolderPath $InstDir ${FOLDERID_UserProgramFiles} ; This folder only exists on Win7+
|
GetKnownFolderPath $InstDir ${FOLDERID_UserProgramFiles} ; This folder only exists on Win7+
|
||||||
StrCmp $InstDir "" 0 +2
|
StrCmp $InstDir "" 0 +2
|
||||||
StrCpy $InstDir "$LocalAppData\Programs" ; Fallback directory
|
StrCpy $InstDir "$LocalAppData\Programs" ; Fallback directory
|
||||||
|
|
||||||
StrCpy $InstDir "$InstDir\$(^Name)"
|
StrCpy $InstDir "$InstDir\$(^Name)"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function un.onInit
|
Function un.onInit
|
||||||
SetShellVarContext Current
|
SetShellVarContext Current
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Section "Program files (Required)"
|
Section "Program files (Required)"
|
||||||
SectionIn Ro
|
SectionIn Ro
|
||||||
|
|
||||||
SetOutPath $InstDir
|
SetOutPath $InstDir
|
||||||
WriteUninstaller "$InstDir\Uninst.exe"
|
WriteUninstaller "$InstDir\Uninst.exe"
|
||||||
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "DisplayName" "${NAME}"
|
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "DisplayName" "${NAME}"
|
||||||
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "DisplayIcon" "$InstDir\MyApp.exe,0"
|
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "DisplayIcon" "$InstDir\MyApp.exe,0"
|
||||||
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString" '"$InstDir\Uninst.exe"'
|
WriteRegStr HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString" '"$InstDir\Uninst.exe"'
|
||||||
WriteRegDWORD HKCU "${REGPATH_UNINSTSUBKEY}" "NoModify" 1
|
WriteRegDWORD HKCU "${REGPATH_UNINSTSUBKEY}" "NoModify" 1
|
||||||
WriteRegDWORD HKCU "${REGPATH_UNINSTSUBKEY}" "NoRepair" 1
|
WriteRegDWORD HKCU "${REGPATH_UNINSTSUBKEY}" "NoRepair" 1
|
||||||
|
|
||||||
File "/oname=$InstDir\MyApp.exe" "${NSISDIR}\Bin\MakeLangId.exe" ; Pretend that we have a real application to install
|
File "/oname=$InstDir\MyApp.exe" "${NSISDIR}\Bin\MakeLangId.exe" ; Pretend that we have a real application to install
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Start Menu shortcut"
|
Section "Start Menu shortcut"
|
||||||
CreateShortcut /NoWorkingDir "$SMPrograms\${NAME}.lnk" "$InstDir\MyApp.exe"
|
CreateShortcut /NoWorkingDir "$SMPrograms\${NAME}.lnk" "$InstDir\MyApp.exe"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This Section registers a fictional .test-nullsoft file extension and the Nullsoft.Test ProgId.
|
This Section registers a fictional .test-nullsoft file extension and the Nullsoft.Test ProgId.
|
||||||
Proprietary file types are encouraged (by Microsoft) to use long file extensions and ProgIds that include the company name.
|
Proprietary file types are encouraged (by Microsoft) to use long file extensions and ProgIds that include the company name.
|
||||||
|
|
||||||
When registering with "Open With" your executable should ideally have a somewhat unique name,
|
When registering with "Open With" your executable should ideally have a somewhat unique name,
|
||||||
otherwise there could be a naming collision with a different application (with the same name) installed on the same machine.
|
otherwise there could be a naming collision with a different application (with the same name) installed on the same machine.
|
||||||
|
|
||||||
REGISTER_DEFAULTPROGRAMS is not defined because proprietary file types do not typically use the Default Programs functionality.
|
REGISTER_DEFAULTPROGRAMS is not defined because proprietary file types do not typically use the Default Programs functionality.
|
||||||
If your application registers a standard file type such as .mp3 or .html or a protocol like HTTP it should register as a Default Program.
|
If your application registers a standard file type such as .mp3 or .html or a protocol like HTTP it should register as a Default Program.
|
||||||
It should also register as a client (https://docs.microsoft.com/en-us/windows/win32/shell/reg-middleware-apps#common-registration-elements-for-all-client-types).
|
It should also register as a client (https://docs.microsoft.com/en-us/windows/win32/shell/reg-middleware-apps#common-registration-elements-for-all-client-types).
|
||||||
*/
|
*/
|
||||||
!define ASSOC_EXT ".test-nullsoft"
|
!define ASSOC_EXT ".test-nullsoft"
|
||||||
!define ASSOC_PROGID "Nullsoft.Test"
|
!define ASSOC_PROGID "Nullsoft.Test"
|
||||||
!define ASSOC_VERB "MyApp"
|
!define ASSOC_VERB "MyApp"
|
||||||
!define ASSOC_APPEXE "MyApp.exe"
|
!define ASSOC_APPEXE "MyApp.exe"
|
||||||
Section -ShellAssoc
|
Section -ShellAssoc
|
||||||
# Register file type
|
# Register file type
|
||||||
WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\DefaultIcon" "" "$InstDir\${ASSOC_APPEXE},0"
|
WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\DefaultIcon" "" "$InstDir\${ASSOC_APPEXE},0"
|
||||||
;WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}" "" "Nullsoft Test App" [Optional]
|
;WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}" "" "Nullsoft Test App" [Optional]
|
||||||
;WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}" "MUIVerb" "@$InstDir\${ASSOC_APPEXE},-42" ; WinXP+ [Optional] Localizable verb display name
|
;WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}" "MUIVerb" "@$InstDir\${ASSOC_APPEXE},-42" ; WinXP+ [Optional] Localizable verb display name
|
||||||
WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}\command" "" '"$InstDir\${ASSOC_APPEXE}" "%1"'
|
WriteRegStr ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}\command" "" '"$InstDir\${ASSOC_APPEXE}" "%1"'
|
||||||
WriteRegStr ShCtx "Software\Classes\${ASSOC_EXT}" "" "${ASSOC_PROGID}"
|
WriteRegStr ShCtx "Software\Classes\${ASSOC_EXT}" "" "${ASSOC_PROGID}"
|
||||||
|
|
||||||
# Register "Open With" [Optional]
|
# Register "Open With" [Optional]
|
||||||
WriteRegNone ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithList" "${ASSOC_APPEXE}" ; Win2000+ [Optional]
|
WriteRegNone ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithList" "${ASSOC_APPEXE}" ; Win2000+ [Optional]
|
||||||
;WriteRegNone ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithProgids" "${ASSOC_PROGID}" ; WinXP+ [Optional]
|
;WriteRegNone ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithProgids" "${ASSOC_PROGID}" ; WinXP+ [Optional]
|
||||||
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\shell\open\command" "" '"$InstDir\${ASSOC_APPEXE}" "%1"'
|
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\shell\open\command" "" '"$InstDir\${ASSOC_APPEXE}" "%1"'
|
||||||
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}" "FriendlyAppName" "Nullsoft Test App" ; [Optional]
|
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}" "FriendlyAppName" "Nullsoft Test App" ; [Optional]
|
||||||
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}" "ApplicationCompany" "Nullsoft" ; [Optional]
|
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}" "ApplicationCompany" "Nullsoft" ; [Optional]
|
||||||
WriteRegNone ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\SupportedTypes" "${ASSOC_EXT}" ; [Optional] Only allow "Open With" with specific extension(s) on WinXP+
|
WriteRegNone ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\SupportedTypes" "${ASSOC_EXT}" ; [Optional] Only allow "Open With" with specific extension(s) on WinXP+
|
||||||
|
|
||||||
# Register "Default Programs" [Optional]
|
# Register "Default Programs" [Optional]
|
||||||
!ifdef REGISTER_DEFAULTPROGRAMS
|
!ifdef REGISTER_DEFAULTPROGRAMS
|
||||||
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities" "ApplicationDescription" "Shell association example test application"
|
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities" "ApplicationDescription" "Shell association example test application"
|
||||||
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities\FileAssociations" "${ASSOC_EXT}" "${ASSOC_PROGID}"
|
WriteRegStr ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities\FileAssociations" "${ASSOC_EXT}" "${ASSOC_PROGID}"
|
||||||
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
|
||||||
|
|
||||||
${NotifyShell_AssocChanged}
|
${NotifyShell_AssocChanged}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
|
||||||
Section -un.ShellAssoc
|
Section -un.ShellAssoc
|
||||||
# Unregister file type
|
# Unregister file type
|
||||||
ClearErrors
|
ClearErrors
|
||||||
DeleteRegKey ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}"
|
DeleteRegKey ShCtx "Software\Classes\${ASSOC_PROGID}\shell\${ASSOC_VERB}"
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_PROGID}\shell"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_PROGID}\shell"
|
||||||
${IfNot} ${Errors}
|
${IfNot} ${Errors}
|
||||||
DeleteRegKey ShCtx "Software\Classes\${ASSOC_PROGID}\DefaultIcon"
|
DeleteRegKey ShCtx "Software\Classes\${ASSOC_PROGID}\DefaultIcon"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
ReadRegStr $0 ShCtx "Software\Classes\${ASSOC_EXT}" ""
|
ReadRegStr $0 ShCtx "Software\Classes\${ASSOC_EXT}" ""
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_PROGID}"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_PROGID}"
|
||||||
${IfNot} ${Errors}
|
${IfNot} ${Errors}
|
||||||
${AndIf} $0 == "${ASSOC_PROGID}"
|
${AndIf} $0 == "${ASSOC_PROGID}"
|
||||||
DeleteRegValue ShCtx "Software\Classes\${ASSOC_EXT}" ""
|
DeleteRegValue ShCtx "Software\Classes\${ASSOC_EXT}" ""
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
# Unregister "Open With"
|
# Unregister "Open With"
|
||||||
DeleteRegKey ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}"
|
DeleteRegKey ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}"
|
||||||
DeleteRegValue ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithList" "${ASSOC_APPEXE}"
|
DeleteRegValue ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithList" "${ASSOC_APPEXE}"
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithList"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithList"
|
||||||
DeleteRegValue ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithProgids" "${ASSOC_PROGID}"
|
DeleteRegValue ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithProgids" "${ASSOC_PROGID}"
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithProgids"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}\OpenWithProgids"
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\${ASSOC_EXT}"
|
||||||
|
|
||||||
# Unregister "Default Programs"
|
# Unregister "Default Programs"
|
||||||
!ifdef REGISTER_DEFAULTPROGRAMS
|
!ifdef REGISTER_DEFAULTPROGRAMS
|
||||||
DeleteRegValue ShCtx "Software\RegisteredApplications" "Nullsoft Test App"
|
DeleteRegValue ShCtx "Software\RegisteredApplications" "Nullsoft Test App"
|
||||||
DeleteRegKey ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities"
|
DeleteRegKey ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities"
|
||||||
DeleteRegKey /IfEmpty ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}"
|
DeleteRegKey /IfEmpty ShCtx "Software\Classes\Applications\${ASSOC_APPEXE}"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
# Attempt to clean up junk left behind by the Windows shell
|
# Attempt to clean up junk left behind by the Windows shell
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Search\JumplistData" "$InstDir\${ASSOC_APPEXE}"
|
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Search\JumplistData" "$InstDir\${ASSOC_APPEXE}"
|
||||||
DeleteRegValue HKCU "Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" "$InstDir\${ASSOC_APPEXE}.FriendlyAppName"
|
DeleteRegValue HKCU "Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" "$InstDir\${ASSOC_APPEXE}.FriendlyAppName"
|
||||||
DeleteRegValue HKCU "Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" "$InstDir\${ASSOC_APPEXE}.ApplicationCompany"
|
DeleteRegValue HKCU "Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" "$InstDir\${ASSOC_APPEXE}.ApplicationCompany"
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows\ShellNoRoam\MUICache" "$InstDir\${ASSOC_APPEXE}" ; WinXP
|
DeleteRegValue HKCU "Software\Microsoft\Windows\ShellNoRoam\MUICache" "$InstDir\${ASSOC_APPEXE}" ; WinXP
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store" "$InstDir\${ASSOC_APPEXE}"
|
DeleteRegValue HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store" "$InstDir\${ASSOC_APPEXE}"
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "${ASSOC_PROGID}_${ASSOC_EXT}"
|
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "${ASSOC_PROGID}_${ASSOC_EXT}"
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "Applications\${ASSOC_APPEXE}_${ASSOC_EXT}"
|
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "Applications\${ASSOC_APPEXE}_${ASSOC_EXT}"
|
||||||
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}\OpenWithProgids" "${ASSOC_PROGID}"
|
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}\OpenWithProgids" "${ASSOC_PROGID}"
|
||||||
DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}\OpenWithProgids"
|
DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}\OpenWithProgids"
|
||||||
DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}\OpenWithList"
|
DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}\OpenWithList"
|
||||||
DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}"
|
DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${ASSOC_EXT}"
|
||||||
;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}"
|
||||||
|
|
||||||
${NotifyShell_AssocChanged}
|
${NotifyShell_AssocChanged}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section -Uninstall
|
Section -Uninstall
|
||||||
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
|
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
|
||||||
Delete "$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}"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
This example script installs a simple application for all users on a machine.
|
This example script installs a simple application for all users on a machine.
|
||||||
|
|
||||||
All-users installers should only write to HKLM, $ProgramFiles, $CommonFiles and the
|
All-users installers should only write to HKLM, $ProgramFiles, $CommonFiles and the
|
||||||
"All context" versions of $LocalAppData, $Templates, $SMPrograms etc.
|
"All context" versions of $LocalAppData, $Templates, $SMPrograms etc.
|
||||||
|
|
||||||
It should not write to HKCU nor any folders in the users profile!
|
It should not write to HKCU nor any folders in the users profile!
|
||||||
If the application requires writable template data in $AppData it
|
If the application requires writable template data in $AppData it
|
||||||
must copy the required files from a shared location the
|
must copy the required files from a shared location the
|
||||||
first time a user launches the application.
|
first time a user launches the application.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
!define NAME "All-users example"
|
!define NAME "All-users example"
|
||||||
!define REGPATH_UNINSTSUBKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
|
!define REGPATH_UNINSTSUBKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
|
||||||
Name "${NAME}"
|
Name "${NAME}"
|
||||||
OutFile "Install ${NAME}.exe"
|
OutFile "Install ${NAME}.exe"
|
||||||
Unicode True
|
Unicode True
|
||||||
RequestExecutionLevel Admin ; Request admin rights on WinVista+ (when UAC is turned on)
|
RequestExecutionLevel Admin ; Request admin rights on WinVista+ (when UAC is turned on)
|
||||||
InstallDir "$ProgramFiles\$(^Name)"
|
InstallDir "$ProgramFiles\$(^Name)"
|
||||||
InstallDirRegKey HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
InstallDirRegKey HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString"
|
||||||
|
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
!include Integration.nsh
|
!include Integration.nsh
|
||||||
|
|
||||||
Page Directory
|
Page Directory
|
||||||
Page InstFiles
|
Page InstFiles
|
||||||
|
|
||||||
Uninstpage UninstConfirm
|
Uninstpage UninstConfirm
|
||||||
Uninstpage InstFiles
|
Uninstpage InstFiles
|
||||||
|
|
||||||
!macro EnsureAdminRights
|
!macro EnsureAdminRights
|
||||||
UserInfo::GetAccountType
|
UserInfo::GetAccountType
|
||||||
Pop $0
|
Pop $0
|
||||||
${If} $0 != "admin" ; Require admin rights on WinNT4+
|
${If} $0 != "admin" ; Require admin rights on WinNT4+
|
||||||
MessageBox MB_IconStop "Administrator rights required!"
|
MessageBox MB_IconStop "Administrator rights required!"
|
||||||
SetErrorLevel 740 ; ERROR_ELEVATION_REQUIRED
|
SetErrorLevel 740 ; ERROR_ELEVATION_REQUIRED
|
||||||
Quit
|
Quit
|
||||||
${EndIf}
|
${EndIf}
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
SetShellVarContext All
|
SetShellVarContext All
|
||||||
!insertmacro EnsureAdminRights
|
!insertmacro EnsureAdminRights
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function un.onInit
|
Function un.onInit
|
||||||
SetShellVarContext All
|
SetShellVarContext All
|
||||||
!insertmacro EnsureAdminRights
|
!insertmacro EnsureAdminRights
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
Section "Program files (Required)"
|
Section "Program files (Required)"
|
||||||
SectionIn Ro
|
SectionIn Ro
|
||||||
|
|
||||||
SetOutPath $InstDir
|
SetOutPath $InstDir
|
||||||
WriteUninstaller "$InstDir\Uninst.exe"
|
WriteUninstaller "$InstDir\Uninst.exe"
|
||||||
WriteRegStr HKLM "${REGPATH_UNINSTSUBKEY}" "DisplayName" "${NAME}"
|
WriteRegStr HKLM "${REGPATH_UNINSTSUBKEY}" "DisplayName" "${NAME}"
|
||||||
WriteRegStr HKLM "${REGPATH_UNINSTSUBKEY}" "DisplayIcon" "$InstDir\MyApp.exe,0"
|
WriteRegStr HKLM "${REGPATH_UNINSTSUBKEY}" "DisplayIcon" "$InstDir\MyApp.exe,0"
|
||||||
WriteRegStr HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString" '"$InstDir\Uninst.exe"'
|
WriteRegStr HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString" '"$InstDir\Uninst.exe"'
|
||||||
WriteRegDWORD HKLM "${REGPATH_UNINSTSUBKEY}" "NoModify" 1
|
WriteRegDWORD HKLM "${REGPATH_UNINSTSUBKEY}" "NoModify" 1
|
||||||
WriteRegDWORD HKLM "${REGPATH_UNINSTSUBKEY}" "NoRepair" 1
|
WriteRegDWORD HKLM "${REGPATH_UNINSTSUBKEY}" "NoRepair" 1
|
||||||
|
|
||||||
File "/oname=$InstDir\MyApp.exe" "${NSISDIR}\Bin\MakeLangId.exe" ; Pretend that we have a real application to install
|
File "/oname=$InstDir\MyApp.exe" "${NSISDIR}\Bin\MakeLangId.exe" ; Pretend that we have a real application to install
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Start Menu shortcut"
|
Section "Start Menu shortcut"
|
||||||
CreateShortcut /NoWorkingDir "$SMPrograms\${NAME}.lnk" "$InstDir\MyApp.exe"
|
CreateShortcut /NoWorkingDir "$SMPrograms\${NAME}.lnk" "$InstDir\MyApp.exe"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
|
||||||
Section -Uninstall
|
Section -Uninstall
|
||||||
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
|
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
|
||||||
Delete "$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}"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue