Archive: Find wether a DLL is in use


Find wether a DLL is in use
Hello,

I would like to find out if a specific DLL is in use by a running process, in order to prompt the user to close it.
Is there a plugin or a macro in NSIS that does it?

I looked in the wiki but no success...

Thanks a lot

Charles


A quick way to do this would just be to backup the file, try to delete it, restore it. If delete fails, the file is in use.


You want to:

1) close the process using the DLL?
Then one could use an NSIS plugin. e.g.
KillProcDLL::KillProc "myapp.exe"

2) or do you want to close the in use in memory DLL?
This is not advised, but somehow doalble, don't know from top of my head, but google is your friend.


Originally posted by onad
You want to:

1) close the process using the DLL?
Then one could use an NSIS plugin. e.g.
KillProcDLL::KillProc "myapp.exe"

2) or do you want to close the in use in memory DLL?
This is not advised, but somehow doalble, don't know from top of my head, but google is your friend.
I hate these things!! What I want to do is to prompt the user to close the application, and retry. So I have to check if the DLL is loaded, and find which process has loaded it.
If I have time I would write a plugin, using the function EnumProcessModules of the Win32 API, it does the job...

Charles