Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Same DLL loaded twice in a process

I have an ActiveX control (foo.dll), when I embedded the same in the IE and start the page. I could see that the process explorer shows two instances of the foo.dll loaded from the same location.

This causes the DLL_PROCESS_ATTACH to be called twice and the global data structures gets initialized twice.

Is there a way to workaround this ? how does the windows loader works ?

Thanks, Velu

like image 587
atVelu Avatar asked Nov 05 '22 21:11

atVelu


1 Answers

DLL_PROCESS_ATTACH should only be called once per instance of the DLL . . . are the DLL's loaded at the same base address, i.e., is the HINSTANCE in DllMain the same? Are they loaded from the exact same path? Different paths result in diffent loaded modules. Is it being unloaded in between the two loads? Are you sure you're seeing DLL_PROCESS_ATTACH and not DLL_THREAD_ATTACH?

like image 60
Michael Avatar answered Nov 26 '22 23:11

Michael