| 351 | }; |
| 352 | |
| 353 | static ssize_t idaapi migr_callback(void *ud, int code, va_list va) |
| 354 | { |
| 355 | MicrocodeInstructionGraphContainer *gcont = (MicrocodeInstructionGraphContainer *)ud; |
| 356 | MicrocodeInstructionGraph *microg = &gcont->m_MG; |
| 357 | |
| 358 | switch (code) |
| 359 | { |
| 360 | #if IDA_SDK_VERSION < 760 |
| 361 | case grcode_user_gentext: |
| 362 | return 1; |
| 363 | #endif //IDA_SDK_VERSION < 760 |
| 364 | |
| 365 | // refresh user-defined graph nodes and edges |
| 366 | case grcode_user_refresh: |
| 367 | // in: interactive_graph_t *g |
| 368 | // out: success |
| 369 | { |
| 370 | interactive_graph_t* mg = va_arg(va, interactive_graph_t*); |
| 371 | mg->resize(microg->m_NumBlocks); |
| 372 | for (auto &it : microg->m_Edges) |
| 373 | mg->add_edge(it.src, it.dst, NULL); |
| 374 | return 1; |
| 375 | } |
| 376 | break; |
| 377 | |
| 378 | // retrieve text for user-defined graph node |
| 379 | case grcode_user_text: |
| 380 | //interactive_graph_t *g |
| 381 | // int node |
| 382 | // const char **result |
| 383 | // bgcolor_t *bg_color (maybe NULL) |
| 384 | // out: must return 0, result must be filled |
| 385 | // NB: do not use anything calling GDI! |
| 386 | { |
| 387 | va_arg(va, interactive_graph_t*); |
| 388 | int node = va_arg(va, int); |
| 389 | const char **text = va_arg(va, const char **); |
| 390 | |
| 391 | microg->tmp = microg->m_BlockText[node]; |
| 392 | *text = microg->tmp.begin(); |
| 393 | return 1; |
| 394 | } |
| 395 | break; |
| 396 | |
| 397 | // retrieve hint for the user-defined graph. |
| 398 | case grcode_user_hint: |
| 399 | //(::interactive_graph_t *) |
| 400 | // mousenode (int) |
| 401 | // mouseedge_src (int) |
| 402 | // mouseedge_dst (int) |
| 403 | // hint (char **) must be allocated by qalloc() or qstrdup() |
| 404 | // retval 0 use default hint; retval 1 use proposed hint |
| 405 | va_arg(va, interactive_graph_t*); |
| 406 | int node = va_arg(va, int); |
| 407 | va_arg(va, int); |
| 408 | va_arg(va, int); |
| 409 | const char **hint = va_arg(va, const char **); |
| 410 | if(node >= 0 && node < microg->m_BlockHint.size()) { |