Archive: Unregistering library


Unregistering library
Hello,
I use this command in my script:

;RegisteraDLL

RegDLL
"$INSTDIR\\PLUGINS\\Library\\library.dll"
This command registers a dll file in Windows system. In uninstaller I have to unregister this library, so I use:
UnregDLL"$INSTDIR\\PLUGINS\\Library\\library.dll"

Library is unregistering, but I don't know why, NSIS uninstaller can't delete this library and folder where it is stored. What I have to do else, to delete all files and folders after unregistering library?

Regards,
Pawel

Is it COM? If so, use CoFreeUnusedLibraries before trying to delete it:

System::Call 'Ole32::CoFreeUnusedLibraries()'

Originally posted by kichik
Is it COM? If so, use CoFreeUnusedLibraries before trying to delete it:
System::Call 'Ole32::CoFreeUnusedLibraries()'
Hello again,
I have tested this many times, but unfortunately it doeasn't work. My dll almost always
stay in the folder and NSIS can't remove it. I want to remove it without restarting system.

My dll is a simple dll that adds to windows context menu a few entries, like this
(after clik right mouse button on folder or file):

Name of my program --> Edit
Open

This dll is unregistering correctly, but it can't be removed!
Is it possible to do it without restarting system?
Thanks for any help,
-Pawel

Because you added it to the context menu, Windows Explorer is using the dll. Most other applications that do that tell you you have to reboot the system to remove it.


The shell is just a process that can be stopped and restarted. (e.g. kill explorer.exe) then restart after the DLL is successfully deleted. I do not state you Should do it this way, only you COULD do it this way. You know we all hate reboots...

TIP:
Try to use "!insertmacro InstallLib ..." not REGDLL anymore, it is obsolete


or if you feel like getting dirty (but not killing explorer.exe), enum all processes and for every process that has your module loaded, inject a special dll (well, you would have to create it) into that process (it should just call CoFreeUnusedLibraries and unload)