summaryrefslogtreecommitdiff
path: root/nasm.nsi
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-07-07 00:56:35 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2011-07-07 00:56:35 +0400
commit117eaa35efd2a2a2d6d595cfc5adfbbd932c4961 (patch)
tree4fd2fdc97534bace30a9a0034d6204b7765a8fb8 /nasm.nsi
parent619bfc87d179dd309edc4d251677e64f056cbdc2 (diff)
downloadnasm-117eaa35efd2a2a2d6d595cfc5adfbbd932c4961.tar.gz
nasm-117eaa35efd2a2a2d6d595cfc5adfbbd932c4961.tar.bz2
nasm-117eaa35efd2a2a2d6d595cfc5adfbbd932c4961.zip
nsis: Make sure the registry keys exist
It was reported on nasm forum (http://forum.nasm.us/index.php?topic=1013.0) that if uninstallation procedure get stopped (for any reason) in a middle leading to read empty registry values an attempt to remove arbitrary files might happen. So make sure there are some sane values in registry. N.B: People, if you find some bug in nasm, don't write to forum, file bug directly in bugzilla, if it's not a bug we simply close it, otherwise we might miss serious problems like this one! Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'nasm.nsi')
-rw-r--r--nasm.nsi16
1 files changed, 14 insertions, 2 deletions
diff --git a/nasm.nsi b/nasm.nsi
index 48feaa9..3801d19 100644
--- a/nasm.nsi
+++ b/nasm.nsi
@@ -183,11 +183,23 @@ SectionEnd
Section "Uninstall"
;
; files on HDD
- RMDir /r /rebootok "$INSTDIR"
+ IfFileExists "$INSTDIR" +3 +1
+ MessageBox MB_OK "No files found, aborting."
+ Abort
+ RMDir /r /rebootok "$INSTDIR"
+ ;
+ ; Links
Delete /rebootok "$DESKTOP\${PRODUCT_SHORT_NAME}.lnk"
;
- ; Start Menu folder
+ ; Start menu folder
ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "lnk"
+ StrCmp $0 0 +1 +3
+ MessageBox MB_OK "Invalid path to a lnk file, aborting"
+ Abort
+ IfFileExists $0 +3 +1
+ MessageBox MB_OK "No lnk files found, aborting."
+ Abort
+ RMDir /r /rebootok "$INSTDIR"
Delete /rebootok "$0\*"
RMDir "$0"
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_SHORT_NAME}"