zoukankan      html  css  js  c++  java
  • 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.
    
  • 相关阅读:
    Instant Python 中文缩减版
    《Java疯狂讲义》(第3版)学习笔记 2
    《Java疯狂讲义》(第3版)学习笔记 1
    NXP Mifare S50标准IC卡- 访问位(Access Bits) 分析
    Python中获取异常(Exception)信息
    支持向量机(SVM)入门
    棋类游戏中人机博弈的设计
    (翻译)如何对python dict 类型按键(keys)或值(values)排序
    Python实现打印二叉树某一层的所有节点
    FIFA halts 2026 bids amid scandal 国际足联在丑闻期间停止2026年足球世界杯申请
  • 原文地址:https://www.cnblogs.com/yilang/p/13457771.html
Copyright © 2011-2022 走看看