7

I have a binary with lots of indirect calls (call dword ptr [register + offset ]) the register is calculated with a simple math which I manage to statically calculate on my own (the call itself lead to some winapi calculated from the current offset)

whenever I try to use AddCodeRefs (ins, winapi, XREF_USER | fl_CN/f) to this data my graph turns out wrong and all the basic blocks become one instruction per basic block; when I try to do the reverse, IDA (logically :/) thinks that the data is really code and reinterprets all of the section to be garbage code.

My question is - Is it possible to create data xrefs from code manually ? AddCodeRefs seem to spoil the graph and I couldn't find any AddDataRefs, I'm using IDA 6.4.

perror
  • 19,083
  • 29
  • 87
  • 150
xrefsfrom
  • 71
  • 1
  • 3

1 Answers1

5

I think you might be looking for add_dref(long From,long To,long drefType). IDA Online Help describes it as following:

Data reference types (combine with XREF_USER!):
#define dr_O    1                       // Offset
#define dr_W    2                       // Write
#define dr_R    3                       // Read
#define dr_T    4                       // Text (names in manual operands)
#define dr_I    5                       // Informational

void    add_dref(long From,long To,long drefType);      // Create Data Ref
void    del_dref(long From,long To);    // Unmark Data Ref

long    Dfirst  (long From);            // Get first data xref from 'From'
long    Dnext   (long From,long current);
long    DfirstB (long To);              // Get first data xref to 'To'
long    DnextB  (long To,long current);
PSS
  • 3,088
  • 1
  • 21
  • 35