AskUsingForm_c函数

IDA SDK里面提供的UI(user interface)函数 AskUsingForm_c,该函数弹出一个对话框,而对话框的外观形式,就由此函数的第一个参数form(const char *类型)指定。

复制代码
  static const char *dialog = // 
  "STARTITEM 0\n" // dont change
  "This is the title\n\n" // dialog title
  "This is static text\n" // static text
  "<String:A:32:32::>\n"  //need char[MAXSTR]
  "<Decimal:D:10:10::>\n"//sval_t*
  "<#No leading 0x#Hex:M:8:10::>\n"//uval_t*
  "<Button:B::::>\n"//formcb_t
  "<##Radio Buttons##Radio 1:R>\n"
  "<Radio 2:R>>\n"//ushort* number of selected radio
  "<##Check Boxes##Check 1:C>\n"
  "<Check 2:C>>\n";//ushort* bitmask of checks
复制代码
复制代码
void idaapi button_func(TView *fields[], int code)
{ 
  msg("The button was pressed!\n");
}

void __stdcall IDP_run(int arg)
{ 
  char input[MAXSTR];
  sval_t dec = 0;
  uval_t hex = 0xdeadbeef;
  ushort radio = 1;
  ushort checkmask = 3;
  qstrncpy(input, "initial value", sizeof(input));
  if (AskUsingForm_c(dialog, input, &dec, &hex, button_func, &radio, &checkmask) == 1)
  { 
    msg("The input string was: %s\n", input);
    msg("Decimal: %d, Hex %x\n", dec, hex);
    msg("Radio button %d is selected\n", radio);
    for (int n = 0; checkmask; n++)
    { 
      if (checkmask & 1)
      { 
        msg("Checkbox %d is checked\n", n);
      }
      checkmask >>= 1;
    }
  }

  return;
}
复制代码

 

复制代码
static const char *dialog1 = // 
  "This is the title\n\n"// dialog title
  "<##Radio Buttons##Radio 1:R>\n"
  "<Radio 2:R>>\n"//ushort* number of selected radio
  "<##Radio Buttons##Radio 1:R>\n"
  "<Radio 2:R>>\n"//ushort* number of selected radio
  "<##Check Boxes##Check 1:C>\n"
  "<Check 2:C>>\n"//ushort* bitmask of checks
  "<##Check Boxes##Check 1:C>\n"
  "<Check 2:C>>\n";//ushort* bitmask of checks

static void idaapi show_dialog1( void )
{
  ushort bitMask, bitMask1 =0;
  ushort btnIndex, bitIndex1;
  int ok = AskUsingForm_c( dialog1, &btnIndex, &bitIndex1, &bitMask, &bitMask1 );
}
复制代码

 

 

posted @   IAmAProgrammer  阅读(621)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
点击右上角即可分享
微信分享提示