Hello everyone,
From MSDN,
http://msdn2.microsoft.com/en-us/library/ms682583.aspx
parameter fdwReason of DllMain has four values,
DLL_PROCESS_ATTACH
DLL_PROCESS_DETACH
DLL_THREAD_ATTACH
DLL_THREAD_DETACH
I think we could simply understand what MSDN described about the four values in the following way after some experiment (I have read the big table and want to extract some brief and simple information to understand to remember),
DLL_PROCESS_ATTACH: will be called only once when the process loads the DLL for the 1st time
DLL_PROCESS_DETACH: will be called only once when the process unloads the DLL (when process stops)
DLL_THREAD_ATTACH: will be called every time when a thread inside the current process loads the DLL
DLL_THREAD_DETACH: will be called every time when a thread inside the current process unloads the DLL
Is that correct understanding?
thanks in advance,
George