blob: 4746d98eef5299e76a505f8421dd83f09438df3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "stdafx.h"
BOOL __stdcall DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process. Return FALSE to fail DLL load.
DisableThreadLibraryCalls( (HMODULE)hinstDLL );
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
if( lpvReserved != nullptr )
{
break; // do not do cleanup if process termination scenario
}
// Perform any necessary cleanup
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
|