BOOL APIENTRY DllMain( HMODULE hModule,
DWORDul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
//当这个DLL被映射到了进程的地址空间时
printf("DLL_PROCESS_ATTACH\n");
break;
case DLL_THREAD_ATTACH:
//一个线程正在被创建
printf("DLL_THREAD_ATTACH\n");
break;
case DLL_THREAD_DETACH:
//线程终结
printf("DLL_THREAD_DETACH\n");
break;
case DLL_PROCESS_DETACH:
//这个DLL从进程的地址空间中解除映射
printf("DLL_PROCESS_DETACH\n");
break;
}
return TRUE;
}
网友评论