Search code examples
registrynsisuninstallation

uninstaller not deleting registry


Function Check32or64BitWindows
${If} ${RunningX64}
      strcpy $INSTDIR "$PROGRAMFILES64\${APP_FULL_PATH}" 
      SetRegView 64

${Else}
       SetRegView 32
       strcpy $INSTDIR "$PROGRAMFILES32\${APP_FULL_PATH}"
${EndIf}
FunctionEnd

If an older version is detected then I execute

ExecWait '"$INSTDIR\uninst.exe" /S' $0

My uninstall section:

Section uninstall
!define APP_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_VENDOR} ${APP_NAME}"
!define APP_UNINST_ROOT_KEY "HKLM"
DeleteRegKey ${APP_UNINST_ROOT_KEY} "${APP_UNINST_KEY}"
SectionEnd

Section -Post
WriteRegStr ${APP_UNINST_ROOT_KEY} "${APP_UNINST_KEY}" "DisplayName" "${APP_FULL_NAME}"
SectionEnd

Post section creates the registry entry in the windows 64bit registry view but uninstaller is not deleting the registry entry.

If I remove the check for 64bit OS, then creation and deletion of registry in Wow6432Node works correctly.


Solution

  • If you are not installing a x64 application you should not use SetRegView/$PROGRAMFILES64 at all.

    If you are installing a x64 application and you called SetRegView 64 during install you also have to call SetRegView 64 in the uninstaller.

    Use Process Monitor to investigate other registry issues...