• Windbg Script---跟踪MessageBox调用


    在过去,我研究了一个支持案例,我需要找出C++应用程序中的一些消息框是否被显示,如果是肯定的,消息是什么。每次我问用户时得到的回答都不一致,所以我不知道是否出现了MessageBox或消息是什么。
    这听起来像是另一个完美的场景,脚本可能会有所帮助!事实上,这对我帮助很大,我希望对你也有帮助。这个脚本映射MessageBox调用,并将消息从MessageBox记录到Windbg屏幕上,也记录到一个文本文件中。
    调试应用程序后,应使用“.logclose”关闭日志。然后您可以搜索字符串“Text from MessageBox”,您将得到应用程序显示的所有MessageBox!
    你可以用DBMon.exe或者DebugView.exe查看来自MessageBox窗口的消息。我从来没有在.NET应用程序上测试过它,但它应该可以工作,因为MessageBox是在一些.NET Framework调用的幕后调用。

    截图如下:

     注意!在上面的命令后按两次回车键而不是一次。

     

     

     Source code for MSGBOX_TRACING.TXT:

    $$
    
    $$ =============================================================================
    
    $$ Log MessageBox messages in a log file.
    
    $$ The log file name starts with MessageBox string.
    
    $$
    
    $$ Compatibility: Win32.
    
    $$
    
    $$ Usage: $$>< to run the script.
    
    $$
    
    $$ Requirements: Public symbols.
    
    $$
    
    $$ Roberto Alexis Farah
    
    $$ Blog: http://blogs.msdn.com/debuggingtoolbox/
    
    $$
    
    $$ All my scripts are provided "AS IS" with no warranties, and confer no rights.
    
    $$ =============================================================================
    
    $$
    
    $$ This location 7EEEEEEE is difficult to be used but
    
    $$ it could be occupied!!!
    
    $$
    
    .dvalloc /b 0x7EEEEEEE 0x400
    
    r @$t0 = 0x7EEEEEEE
    
    eb 0x7EEEEEEE 50
    
    bp user32!MessageBoxExW "r @$t1 = @eip; r @eax = poi(@esp + 0x8); r @eip = @$t0;g"
    
    bp @$t0 + 0x6 ".echo <-- Text from MessageBox; r @$ip = @$t1;g"
    
    .logopen /t /u MessageBox.txt
    
    .printf /D "
    Type <b>call kernel32!OutputDebugStringW</b> then press Enter key two times then 'g' command after it.
    "
    
    a 0x7EEEEEEF
    
    $$
    
    $$ ATTENTION! Use .logclose after finishing the debugging session.
    
    $$
    
    $$ =========================
    
    Note: Some of my previous scripts were updated! Whenever I do that I write a small comment about it explaining the update.
    
  • 相关阅读:
    spring3.1, hibernate4.1 配置备份,struts2.2.1,sitemesh 2.4.2
    java 动态AOP
    制作可以执行的 JAR 文件包及 jar 命令详解
    struts result Annotation 参考
    Android线段与矩形碰撞检测函数
    防止aspxspy木马列服务 iis信息 执行命令提权等操作
    博客园申请及页面定制CSS
    C# 中将月份格式化为英语缩写格式
    通过Web Service获取天气预报并朗读
    windows下html/javascript调用可执行程序
  • 原文地址:https://www.cnblogs.com/yilang/p/13457771.html
Copyright © 2020-2023  润新知