Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Uninstaller (http://forums.winamp.com/showthread.php?t=380394)

badcom 22nd January 2015 21:55

Uninstaller
 
Hi guys,

I'm struggling to uninstall a program. The problem is that it won't delete the file Uninstall.exe neither the install folder.

Here's my code:

code:

;function for check previous version
Function CheckPreviousVersion

Call KillRunning

ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" \
"UninstallString"
StrCmp $R0 "" done

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort

;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:

done:

FunctionEnd

; ===============================================================================================
; == *** UN-INSTALLER *** ==
; ===============================================================================================
Section "Uninstall"
call un.KillRunning ; close any already running

# Always delete uninstaller first
Delete $INSTDIR\Uninstall.exe

;Delete Start Menu Shortcuts
;alter to be wildcard - we do not know how many the user chose to install
Delete "$DESKTOP\Emod Firefox *.lnk"
;Delete "$DESKTOP\Emod Chrome *.lnk"

;Delete Files & directory
RMDir /r "$INSTDIR"

;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"



Any suggestion?

Thanks in advance!

Anders 22nd January 2015 22:20

Does it only happen when you are using _?= with ExecWait or is normal uninstall also broken?

Can you try Process Monitor and see why the delete fails?


All times are GMT. The time now is 17:17.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.