Thread: calculate class function vtable offset?

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    288

    calculate class function vtable offset?

    Im wondering how its done, I notice in directx hooking examples, they usually have the offsets defined as constants. how do they calculate these offsets?

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The COM specification contains a place that says that the offset is sizeof(function pointer) * function ordinal bytes.

    The Microsoft C++ compiler "happens" to use the same layout for the vtable.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    figured it out, thanks alot .
    Last edited by X PaYnE X; 10-28-2006 at 11:34 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 03:33 AM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM