How to check dll's reference count? How to know where the dll was loaded?

Viewed 13730

As you know, if the call to LoadLibrary specifies a DLL module already mapped into the address space of the calling process, the function simply returns a handle of the DLL and increments the module's reference count.

Somewhere, I need to get the reference count of a dll. How to get the dll's reference count? How to know where the dll was loaded? Thanks.

8 Answers

You can enumerate the loaded modules in a process with Module32First()/Module32Next() and then use MODULEENTRY32.GlblcntUsage to check it's reference count. I'm not sure how reliable this is though.

Related