calculate class function vtable offset?

This is a discussion on calculate class function vtable offset? within the C++ Programming forums, part of the General Programming Boards category; Im wondering how its done, I notice in directx hooking examples, they usually have the offsets defined as constants. how ...

  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,892
    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, 12:03 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21