|
[求助]DLL注入后HOOK的奇怪问题!
记得卸载钩子,不然会有不必要的麻烦 BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: hmodule=hModule; myhook = SetWindowsHookEx(WH_KEYBOARD, HOOKCL, hmodule, 0);//安装钩子后想监控的线程的ID号 break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE; } #ifdef _MANAGED #pragma managed(pop) #endif void WINAPI HOOK()// 把这个函数去掉 { myhook=SetWindowsHookEx( WH_KEYBOARD,//钩子类型 (HOOKPROC)HOOKCL,//钩子函数地址 hmodule,//钩子函数所在DLL的实例句柄 0);//安装钩子后想监控的线程的ID号 //返回参数为钩子句柄 //UnhookWindowsHookEx 参数只有一个,为要卸载的钩子句柄 //WaitForInputIdle(myhook, 1000); Sleep(1000);//等待1000秒 } 我自己写了一个小程序测试了一下: EXE代码: #include <Windows.h> #include <stdlib.h> int _tmain(int argc, _TCHAR* argv[]) { HMODULE hMod = LoadLibrary( _T("dll.dll") ); printf( "%08x", (DWORD)hMod ); system("pause"); return 0; } DLL代码: #include <Windows.h> #include <tchar.h> LRESULT CALLBACK KeyBordProc( int nCode, WPARAM wParam, LPARAM lParam ) { if ( ( (DWORD)lParam & 0x40000000 ) && ( HC_ACTION == nCode ) ) { switch( wParam ) { case '1': MessageBox( NULL, _T("fuck 1"), NULL, 0 ); break; case '2': MessageBox( NULL, _T("fuck 2"), NULL, 0 ); break; } } return 0; } BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { HHOOK hHook = NULL; switch( ul_reason_for_call ) { case DLL_PROCESS_ATTACH: { hHook = SetWindowsHookEx( WH_KEYBOARD, KeyBordProc, hModule, 0 ); } break; case DLL_PROCESS_DETACH: break; } return TRUE; } |
|
|
|
Xtreme-Protector 的强度
Safengine |
|
[原创]在哪片山唱哪首歌
他悲剧了 |
|
|
|
[原创]NetBoxDex v0.1 (NetBox 解包工具源码)
那才更能说明我非常的关心他 |
|
|
|
[注意]KmdKit4D重大更新
楼主辛苦了,捧场 |
|
发布一个项目的构思,愿意做的来看看
不得不膜拜楼上,膜拜 |
|
|
|
[招聘]北京焜安(盛大集团成员企业)2010年人员招聘
保持观望。。。 |
|
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值