| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- // 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;
- }
|