Old 22nd January 2015, 21:55   #1
badcom
Junior Member
 
Join Date: Oct 2014
Posts: 4
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!
badcom is offline   Reply With Quote
Old 22nd January 2015, 22:20   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
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?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump