|
[求助]ring3 inline hook
谢谢楼上的兄弟! |
|
[求助]ring3 inline hook
好吧,我承认我太水了,问题果然很简单 改动如下: __declspec(naked) int _stdcall MyMessageBoxA( HWND hWnd, // handle to owner window LPCTSTR lpText, // text in message box LPCTSTR lpCaption, // message box title UINT uType // message box style ) { __asm{ push esi } printf("MyMessageBoxA is called\n"); MyFunc(); //可以加入函数过程 __asm{ pop esi jmp realAddress ret } } debug版的代码中加入了堆栈平衡的相关代码,在进入MyMessageBoxA函数以后,把ESI的值设置为了当前ESP的值,结果就是函数返回时ESP回来了,但是ESI是错误的 问题解决了,心情舒畅 |
|
[求助]ring3 inline hook
Release问题解决了,jmp_back函数去掉,申请一块内存来保存原函数头部指令和jmp_back指令......eek: |
|
[求助]ring3 inline hook
下面是Release版的问题: 运行环境仍然为Win7+vs2010生成Release版,调试发现,程序在 //将保存的指令复制到jmp_backAddr处 memcpy((BYTE *)jmp_backAddr, orig_code, 5); 发生内存写入异常。进一步分析定位到 VirtualProtect((LPVOID)jmp_backAddr, 10, PAGE_EXECUTE_READWRITE, &dwOldProtect); 修改页保护属性失败,查看MSDN: You can set the access protection value on committed pages only. If the state of any page in the specified region is not committed, the function fails and returns without modifying the access protection of any pages in the specified region. 接下来使用 MEMORY_BASIC_INFORMATION mbi; 查看jmp_backAddr所在页面的属性,发现数据无效。经调试,在进入Hook函数后,mbi中的数据就已经有了,而Debug版的mbi的数据是真是获取的。。。问题有点匪夷所思,真的很郁闷,求拯救啊 |
|
[求助]ring3 inline hook
我试了好多次,发现: 把代码中的 printf("MyMessageBoxA is called\r\n"); 去掉,Debug版就不再报错,但是依旧没弄明白原因。 查看反汇编,也没发现破坏堆栈的指令: 00E417C0 mov esi,esp 00E417C2 push offset string "MyMessageBoxA is called\r\n" (0E45784h) 00E417C7 call dword ptr [__imp__printf (0E48354h)] 00E417CD add esp,4 00E417D0 cmp esi,esp 00E417D2 call @ILT+340(__RTC_CheckEsp) (0E41159h) 而且这玩意的Release版压根就不能工作。。。 哪位大哥,知道原因请不吝赐教啊,小菜不胜感激! |
|
[求助]ring3 inline hook
都没人回啊,是不是问题太低级了 |
|
|
|
[原创]详解截取封包的原理
真的很不错,学习了 |
操作理由
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 }}
勋章
兑换勋章
证书
证书查询 >
能力值