-
-
[求助]关于HOOK API的问题
-
发表于:
2008-8-24 10:10
4657
-
CAPIHook g_OpenProcessA;
typedef int (WINAPI *PFNOpenProcess)(HWND hWnd , LPCSTR lpText, LPCSTR lpCaption, UINT uType);
int WINAPI MyOpenProcessA(HWND hWnd , LPCSTR lpText, LPCSTR lpCaption, UINT uType)
{
int nResult=0;
nResult=((PFNOpenProcess)(PROC)g_OpenProcessA)(hWnd,"Stop!",lpCaption,uType);
return nResult;
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH: OutputDebugString("Hook DLL Load! Live In module:");
penProcessA.HookFunc("user32.dll","OpenProcess",(PROC)OpenProcessA,TRUE);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
OutputDebugString("Hook DLL Exit! Leave module:");
g_OpenProcessA.UnHookFunc();
LRESULT WINAPI MsgProc(int code, WPARAM wParam, LPARAM lParam)
{
//注意 :on windows 2k ,CallNextHookEx 的第一个参数可以为空
//On win 98 ,必须有钩子句柄
return(CallNextHookEx(NULL,code,wParam,lParam));
}
代码老出错!我想做个在任务管理器不能关闭自己的程序,请高手帮忙!
不帮忙的笑话新手的走开!
[培训]科锐逆向工程师培训第53期2025年7月8日开班!