修改程序以假装按下按钮
我有一个 MFC 应用程序(没有源代码),它打开一个带有“更新”按钮的窗口,然后在单击后执行很长的更新。
我想修改程序,以便在创建窗口(或其他地方,例如 DoModal)时,向程序发送一条消息,使其认为按钮已按下。
我在 Ida Pro 和 OllyDbg 中对此进行了一段时间的尝试,但没有成功。 我考虑过使用 PumpMessage 的可能性,但这并没有带来任何成功。
有什么建议吗?
I have an MFC application that I was given (without source code) which opens a window with an 'Update' button, which then performs a very long update after being clicked.
I'd like to modify the program so that when the window is created (or somewhere else such as DoModal), a message is sent to the program to make it think that the button was pressed.
I've been toying around with this for a while in Ida Pro and OllyDbg to no avail. I looked at possibly using PumpMessage, but this did not bring any success.
Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需创建第二个程序即可启动它,并使用 SendInput(...)
Just create a 2nd program that will lunch it and will send a mouse click using SendInput(...)
如果您不喜欢使用辅助“宏”程序的想法,您可以修补原始程序的二进制文件以调用按钮的 BM_CLICK 处理程序。 如果你能找到一些空间用于调用(无参数至少 5 个字节),你可以单独使用 OllyDbg 来完成此操作(编辑代码后,选择它,然后从右侧选择“复制到可执行文件”->“选择”-单击菜单)。 否则,您需要使用 PE 编辑器(例如 LordPE 或 PE Tools)创建一个新的代码部分,并在其中添加代码(通常您需要将程序中的调用更改为跳转到您的部分,您可以在其中添加代码)执行原始调用加上对按钮的单击处理程序的调用,然后在修补跳转后跳回旧位置)。
If you don't like the idea of using a secondary "macro" program, you could patch the original program's binary to call the button's BM_CLICK handler. If you can find some space for the call (minimum 5 bytes without arguments), you can do this with OllyDbg alone (after editing the code, select it, and select "Copy to executable" -> "Selection" from the right-click menu). Otherwise, you'll need to create a new code section with a PE editor (e.g. LordPE or PE Tools) and add your code there (typically you'll want to change a call in the program to a jump to your section, where you perform the original call plus the call to the button's click handler, then jump back to the old position after your patched jump).
使用测试自动化技术有几种方法可以做到这一点,但最简单的方法是简单地获取所需按钮的窗口句柄并向其发送
BM_CLICK
消息。 这假设您具有 Windows 上的 C/C++ 应用知识。 如果没有,还有使用 .NET 或其他技术的其他方法。 我不熟悉 ida-pro 或 ollydbg。There are a few ways to do it using test automation techniques, but the simplest is to simply get the window handle for the button you want and send it a
BM_CLICK
message. This assumes that you have a working knowledge of C/C++ on Windows. If not, there are other means using .NET or other technologies. I'm not familiar with ida-pro or ollydbg.请参阅这个 perl 模块 win32::guitest 它可以帮助您做到这一点。您可以用它编写一个 perl 脚本并将其嵌入到您的程序中。 或者您可以使用 win32 api 来包装您所需的需求并使用它。
See this perl module win32::guitest it could help you to do this.you can write with it a perl script and embed it in your program. or you can use the win32 api that wrap your required needs and use it.