Old 9th July 2010, 09:54   #1
TheGrudge
Junior Member
 
Join Date: Jul 2010
Posts: 9
Cancel / Revert changes when DLL is locked

Hi,

I want to cancel the deinstaller when a DLL file is still openend by another app, like IE.
How can I detect this?

I used the following code:
code:
# check if IE is locking 'hbxie.dll'
ClearErrors
FileOpen $R0 "$INSTDIR\hbxie.dll" w
${If} ${Errors}
# File is locked.
${Else}
FileClose $R0
${EndIf}



but this only works when INSTALLING, not deinstalling.
Also I'd like to revert changes when an error occured and the user clicked "cancel".
Is this possible?

I searched the forum, but the only solution I came up with so far is the above makro, which doesn't work when removing the file.
TheGrudge is offline   Reply With Quote
Old 9th July 2010, 11:01   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Take a look at the LockedList plugin.
MSG is offline   Reply With Quote
Old 9th July 2010, 11:05   #3
TheGrudge
Junior Member
 
Join Date: Jul 2010
Posts: 9
Yes, I already found out about this one, and it seems to work fine :-)
But thanks for the tipp

The only thing I'm not sure how to do now is to do a revert.
Let's say installation fails at 67%, reasons unknown. The user presses Cancel, but the already installed files and registry keys are not removed.

Is there a built-in solution?
TheGrudge is offline   Reply With Quote
Old 9th July 2010, 11:19   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
There is no built-in solution. There are however some header files that can help with semi-automated deletion of installed files:
http://nsis.sourceforge.net/Uninstal...nstalled_files
http://nsis.sourceforge.net/Advanced...og_NSIS_Header

I've never used them myself, so I can't help you there. Personally, I prefer doing everything myself, at least that way I know exactly what's going on. What I do is create the uninstaller as the first step in the installation process. That way I can rollback installation even if it fails halfway. (My uninstallers only remove what I know I installed myself, like every good uninstaller should.)
MSG is offline   Reply With Quote
Old 9th July 2010, 12:13   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Another option:
http://nsis.sourceforge.net/Install_on_reboot

Stu
Afrow UK 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