Click to See Complete Forum and Search --> : my own dll atached


lukhas
April 20th, 2003, 04:01 PM
Hello all.I would like write my own DLL.I read that when a DLL is atached or deatached receive msg DLL_PROCESS_ATACH or DLL_PROCESS_DEATACH and same with threads.Is there any way to know idprocess or idthread or module name that is trying atach my DLL in each moment and how many are atached or deatached my DLL?.Thanks all.;)

JamesSchumacher
April 20th, 2003, 04:17 PM
Attaching to your *.dll wouldn't be too hard, create a shared data section using the #pragma data_seg and have a variable in there that you increment upon each DLL_PROCESS_ATTACH and decrement on each DLL_PROCESS_DETACH.

Look up that #pragma in MSDN if you are using VC++, I don't know how to do it with another compiler.