title: Is it possible in IDA Pro to make a struct field offset to vtable which is defined in .data segment?
body: <p>Here is what I want to achieve. I identified a class which I defined as a struct to store class data. One of the methods of the class uses class-field as if it's pointer to vtable.</p>
  
  <pre><code>int __thiscall SignOn(struc_4 *this)
  {
    v1 = this;
    if ( !v1-&gt;vtable_40194AE0 )
      return E_UNEXPECTED;
    v1-&gt;field_3E8 = 0;
    if ( !sub_686F7193(v1) )
      return (*(*v1-&gt;vtable_40194AE0 + 12))(v1-&gt;vtable_40194AE0, 0, 0); // sub_40128EEE
  }
  </code></pre>
  
  <p>As you can see it calls 3rd function from vtable. In run-time I identified that vtable_40194AE0 points to array in .data section which looks like this</p>
  
  <pre><code>off_40194AE0    dd offset InternalQueryInterface
                  dd offset AddRef
                  dd offset Release
                  dd offset sub_40128EEE  ; 3
                  dd offset sub_40128F8C
                  dd offset sub_4012C2E2  ; 5
  </code></pre>
  
  <p>Is there a way to tell somehow IDA that vtable_40194AE0 always points to vtable at 0x40194AE0 so given call in the pseudo-code will look like</p>
  
  <pre><code>return vtable_40194AE0-&gt;sub_40128EEE(v1-&gt;vtable_40194AE0, 0, 0);
  </code></pre>
  
  <p>?</p>
  
  <p>I tried to set vtable_40194AE0 of the structure to be "user-defined offset" but it doesn't help :(</p>
  
  <p>Thanks a lot !</p>