// dllmain.cpp : 定义 DLL 应用程序的入口点。 #include "stdafx.h" #include "Hook.h" #include HINSTANCE g_Inst = NULL; //DLL模块句柄 BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { g_Inst = (HINSTANCE)hModule; if (ul_reason_for_call == DLL_PROCESS_ATTACH) { TCHAR Buffer[MAX_PATH]; if (GetModuleFileName(NULL, Buffer, MAX_PATH)) { TCHAR* a = Buffer; } else { // You better call GetLastError() here } Hook(); } else if (ul_reason_for_call == DLL_THREAD_ATTACH) { } else if (ul_reason_for_call == DLL_THREAD_DETACH) { } else if (ul_reason_for_call == DLL_PROCESS_DETACH) { TCHAR Buffer[MAX_PATH]; if (GetModuleFileName(NULL, Buffer, MAX_PATH)) { TCHAR* a = Buffer; } else { // You better call GetLastError() here } UnHook(); } return TRUE; }