0

I have an application, which has a dll (and of course some more files). During the installation, this dll will be registered, so additional menus are available in some context menus. If i uninstall this appliation the dll file remains "locked", which means, i can't delete it. I have to reboot the pc to delete this file.

So my question is, is it possible to make an application, which can close the open handles, or unregister the dll, or whatever needs to be done, to be able to delete this dll without a reboot?

Thanks in advance!

kampi
  • 2,362
  • 12
  • 52
  • 91
  • My crystal ball says that this is a shell extension. Sure, the DLL file is locked because it is loaded into Explorer.exe. Killing Explorer isn't very reasonable, uninstallers do it by using the PendingFileRenameOperations registry key. – Hans Passant Feb 06 '15 at 20:06
  • 1
    Open "Process Explorer", press Ctrl + D to open image view. Then search for the dll name. Kill the process that has loaded it. – Mustafa Chelik Feb 06 '15 at 20:12
  • @Hans: the smarter shell extension installers/uninstallers/upgraders do shut down and restart Explorer - not by killing it, of course. I think they use the Restart Manager. (IIRC, TortoiseSVN is one example) – Harry Johnston Feb 07 '15 at 00:35

1 Answers1

0

In windows shell use
regsvr32 <yourfile>.dll for registering a file
regsvr32 /u <yourfile>.dll for unregistering a file

Eugene Sh.
  • 17,802
  • 8
  • 40
  • 61
  • sorry i forgot to mention, that this doesn't work. i assume the dll is registered somehow else. – kampi Feb 06 '15 at 19:34
  • 1
    How is it registered otherwise? You might have some processes that are using the DLL. Check the task manager whether your program or any other possible consumer of this DLL is running. – Eugene Sh. Feb 06 '15 at 19:35
  • explorer.exe uses that dll. i can see that in process explorer. but i can't close explorer.exe. That's why i want to close only that handle or something that keeps the dll from deletion. – kampi Feb 06 '15 at 19:48
  • That's interesting. Is this DLL injected to explorer.exe? Is it used for some kind of hooks? – Eugene Sh. Feb 06 '15 at 19:50
  • i don' know exactly. i didn't make the appplication. if you install it, you'll have two extra options in the desktop context menu. you can save and restore your desktop icon location. – kampi Feb 06 '15 at 19:52
  • OK, so it's a shell extension DLL. There is no way of unregistering it until the processes using it are killed. Look here: http://stackoverflow.com/questions/11365944/how-to-unload-c-shell-extension-dll-properly – Eugene Sh. Feb 06 '15 at 19:56