开发者

NSIS script help-install without killing explorer

开发者 https://www.devze.com 2023-01-25 14:36 出处:网络
When I tried to un-install and install an executable foo.exe, Im geting the below error Error opening file for writing

When I tried to un-install and install an executable foo.exe, Im geting the below error

Error opening file for writing
click abort to stop the installation

I could find that some files were failed to get deleted while un-installation. And by using process explorer I can see that explorer.exe has still reference to some dlls of foo.exe even after unregistering them.

and killing the explorer.exe and re-start it again while un-insta开发者_StackOverflowllation solves the issue. (thru NSIS installation script).

or by setting rebook ok flag in script and ask user to re-start his machine before installing foo.exe again.

I don't think its a good solution to ask user to reboot his machine after un-installation .

Can anyone help me on how can I make sure that my installation goes fine instead of restarting explorer.exe


For registered shell extensions there is really no clean way to delete the dll's other than forcing a reboot (Or log-off if they are registered in HKCU\Software\Classes)

If that is not good enough you basically have two options:

  • Rename the .dll and delete it later
  • <HACKALERT>Inject a thread that calls CoFreeUnusedLibraries() into every process that has your dll loaded</HACKALERT>

Just killing and restarting explorer is not really an option since you don't know if some other program is also using your shell extension.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号