| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // dllmain.cpp : 定义 DLL 应用程序的入口点。
- #include "stdafx.h"
- #include "Hook.h"
- #include <windows.h>
- 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;
- }
|