zoukankan      html  css  js  c++  java
  • IDA IDC Tutorials: Additional Auto-Commenting

    https://www.hex-rays.com/products/ida/support/tutorials/idc/autocomment.shtml

    This program creates a segment at paragraph 0x40 and comments the BIOS data area. You should load and execute this file to see the names of BIOS data area variables.

    //-------------------------------------------------------------------------
    static CW(off,name,cmt) {
      auto x;
      x = [ 0x40, off ];
      MakeWord(x);
      MakeName(x,name);
      MakeRptCmt(x,cmt);
    }
    
    //-------------------------------------------------------------------------
    static CD(off,name,cmt) {
      auto x;
      x = [ 0x40, off ];
      MakeDword(x);
      MakeName(x,name);
      MakeRptCmt(x,cmt);
    }
    
    //-------------------------------------------------------------------------
    static CB(off,name,cmt) {
      auto x;
      x = [ 0x40, off ];
      MakeByte(x);
      MakeName(x,name);
      MakeRptCmt(x,cmt);
    }
    
    //-------------------------------------------------------------------------
    static CmtBdata() {
     CW(0x000,"com_port_1","Base I/O address of 1st serial I/O port");
     CW(0x002,"com_port_2","Base I/O address of 2nd serial I/O port");
     CW(0x004,"com_port_3","Base I/O address of 3rd serial I/O port");
     CW(0x006,"com_port_4","Base I/O address of 4th serial I/O port");
    
     CW(0x008,"prn_port_1","Base I/O address of 1st parallel I/O port");
     CW(0x00A,"prn_port_2","Base I/O address of 2nd parallel I/O port");
     CW(0x00C,"prn_port_3","Base I/O address of 3rd parallel I/O port");
     CW(0x00E,"prn_port_4","Base I/O address of 4th parallel I/O port");
     MakeArray([0x40,0x01E ], 16 );
     CB(0x03E,"dsk_recal_stat",     "Recalibrate floppy drive bits
    "
                    "   3       2       1       0
    "
                    "drive-3 drive-2 drive-1 drive-0
    "
                    "
    "
                    "bit 7 = interrupt flag");
    CW(0x0CE,"days_since1_80",     "Days since 1-Jan-1980 counter");
     MakeArray(0x4AC,0xCE-0xAC);
    }
    
    //-------------------------------------------------------------------------
    static main() {
      if ( !SegCreate(0x400,0x4D0,0x40,0,0,2) ) {
        Warning("Can't create BIOS data segment.");
        return;
      }
      SegRename(0x400,"bdata");
      SegClass(0x400,"BIOSDATA");
      CmtBdata();
    }
    #include <idc.idc>
    
    //-------------------------------------------------------------------------
    static CW(off,name,cmt) {
      auto x;
      x = 0x400 + off;
      MakeWord(x);
      MakeName(x,name);
      MakeRptCmt(x,cmt);
    }
    
    //-------------------------------------------------------------------------
    static CD(off,name,cmt) {
      auto x;
      x = 0x400 + off;
      MakeDword(x);
      MakeName(x,name);
      MakeRptCmt(x,cmt);
    }
    
    //-------------------------------------------------------------------------
    static CB(off,name,cmt) {
      auto x;
      x = 0x400 + off;
      MakeByte(x);
      MakeName(x,name);
      MakeRptCmt(x,cmt);
    }
  • 相关阅读:
    Linux内存管理(text、rodata、data、bss、stack&heap)
    名词解释:Linux内存管理之RSS和VSZ
    数据库对比:选择MariaDB还是MySQL?
    linux 下 pip 安装教程
    Mysqlbinlog工具及导出数据并转换编码导入
    运维监控系统之Open-Falcon
    MySQL binlog格式解析
    理解和配置Out of memory: Kill process
    mysql优化——explain详解
    mysql性能优化-慢查询分析、优化索引和配置 (慢查询日志,explain,profile)
  • 原文地址:https://www.cnblogs.com/shangdawei/p/3316079.html
Copyright © 2011-2022 走看看