将钩子DLL注入某进程后,如何让钩子在进程中安装(installhook)?

wellin 2003-09-15 01:49:28
如题
...全文
80 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xpf_2000 2003-10-15
  • 打赏
  • 举报
回复
up
papaya_stone 2003-09-15
  • 打赏
  • 举报
回复
DllMain()函数的第一个参数:
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved);

if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(ReadScrDLL, hInstance))
return 0;

g_hInst=hInstance;//保存hInstance到全局变量

new CDynLinkLibrary(ReadScrDLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
// Terminate the library before destructors are called
AfxTermExtensionModule(ReadScrDLL);
}
return 1; // ok
}



theApp.m_hInstance
wellin 2003-09-15
  • 打赏
  • 举报
回复
SetWindowsHooEx(a,b,hins,0););
中第三个参数hins怎么得到?
我用
AFX_MANAGE_STATE(AfxGetStaticModuleState());
hins=AfxGetInstanceHandle();
编译提示“undeclared identifier”未定义,是缺少什么头文件支持吗?
papaya_stone 2003-09-15
  • 打赏
  • 举报
回复
SetWindowsHooEx();

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧