Frida修改函数的返回值的问题
功能描述:Windows下面的某个exe应用程序,基于MFC的对话框应用小工具。该工具与某个硬件(USB口,非安卓设备)进行通讯,其中有一个函数(比如abcde),用户获取硬件的状态信息,当检测到某个字段改变后,就能显示出全部功能,否则只能显示出一小部分功能。
问题描述:现在我用frida结合js脚本,已经实现了这个返回返回值的替换。然而在实际测试过程中,发现该功能并未真实生效。如下所示,返回值和真机上操作的返回值是相同的(把c7改为d7)。请问这个会是什么原因?我的目标是不用连接物理硬件而直接Hook该函数能显示出全部的完整功能。
onLeave structPtr: 0xf94f520
Original function return value: 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000050 aa bb cc dd ee ff c7 aa bb cc dd ee ff aa bb cc
00000060 00 38 f0 40 00 00 00 00 00 00 10 01 00 01 00 00
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Modifying value at position 86 from 0xc7 to 0xd7.
Value at position 86 after modification: 0xd7
xxxxx value after modification: 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000050 aa bb cc dd ee ff d7 aa bb cc dd ee ff aa bb cc
00000060 00 38 f0 40 00 00 00 00 00 00 10 01 00 01 00 00
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Function returned: 0