2011-02-17 15 views

Odpowiedz

11

Rejestracja deinstalacji są przechowywane w rejestrze, gdzie w rejestrze należy zapisać to zależy, czy instalator instaluje program dla wszystkich użytkowników lub pojedynczego użytkownika (IE Twój RequestExecutionLevel ustawienie):

  • user = HKCU
  • Admin = HKLM
  • najwyższa = SHCTX (oznacza to, że trzeba użyć SetShellVarC ontext poprawnie, a także poprawnie go przywrócić w deinstalatorze)

Wymagane są tylko dwie wartości: DisplayName i UninstallString.

!define REGUNINSTKEY "MyApplication" ;Using a GUID here is not a bad idea 
!define REGHKEY HKLM ;Assuming RequestExecutionLevel admin AKA all user/machine install 
!define REGPATH_WINUNINST "Software\Microsoft\Windows\CurrentVersion\Uninstall" 

Section 
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "DisplayName" "My application" 
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "UninstallString" '"$INSTDIR\uninstaller.exe"' 
SectionEnd 

Istnieje kilka opcjonalnych wartości można ustawić, MSDN nie naprawdę dostarczyć listę udokumentowanych wartościach ale NSIS Wiki has a decent list i this page ma jeszcze bardziej kompletna lista ...

+0

nb Istnieje osobna lokalizacja dla instalacji 32-bitowych na komputerze 64-bitowym: https://superuser.com/a/293896/41494 – icc97

+0

@ icc97 To naprawdę zależy. 32-bitowy instalator zapisze w 32-bitowej części rejestru w 64-bitowym systemie Windows. Ale aby wyświetlić klucz w Regedit, a następnie tak, musisz wyświetlić klucz WoW64, jeśli uruchomisz 64-bitowy plik Regedit.exe. – Anders

3

Przykład użycia:

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "DisplayName" "<Name>" ;The Name shown in the dialog 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "UninstallString" "$INSTDIR\<Path to uninstaller>" 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "InstallLocation" "$INSTDIR" 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "Publisher" "<Your Name>" 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "HelpLink" "<URL>" 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "DisplayVersion" "<Version>" 
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "NoModify" 1 ; The installers does not offer a possibility to modify the installation 
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "NoRepair" 1 ; The installers does not offer a possibility to repair the installation 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "ParentDisplayName" "<Parent>" ; 
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \ 
    "ParentKeyName" "<ParentKey>" ; The last two reg keys allow the mod to be shown as an update to another software. Leave them out if you don't like this behaviour 
Powiązane problemy