| | |
How to access VPTR in my program?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2009
Posts: 903
Reputation:
Solved Threads: 144
"Careful Jim": http://kaisar-haque.blogspot.com/200...ual-table.html
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
Hi,
That was an amazing article to go through & a great insight. Thanks alot for sharing this.
Can you share me more details :
1) Following is puzzling me:
( (void (*)()) vptr[0] )();
I am sure we can split this in multiple instrcutions to make it more user readable?
Can you help by splitting so that it is understandable to me?
2) I checked this program in "Microsoft Visual C++ 2005", but i could not get the value of "n", even if the __asm instructions are present. It seems "Microsoft Visual C++ 2005" does not use ECX register for this pointer. Is it so?
Regards,
Vivek
That was an amazing article to go through & a great insight. Thanks alot for sharing this.
Can you share me more details :
1) Following is puzzling me:
( (void (*)()) vptr[0] )();
I am sure we can split this in multiple instrcutions to make it more user readable?
Can you help by splitting so that it is understandable to me?
2) I checked this program in "Microsoft Visual C++ 2005", but i could not get the value of "n", even if the __asm instructions are present. It seems "Microsoft Visual C++ 2005" does not use ECX register for this pointer. Is it so?
Regards,
Vivek
•
•
Join Date: Jul 2008
Posts: 134
Reputation:
Solved Threads: 14
Spent a lot of time working with that some time ago. Here's a daniweb link...
http://www.daniweb.com/forums/thread144510.html
Also, here's a link to some of my tutorials using C, C++ and PowerBASIC where I pretty much take COM memory apart and look close at VTables, VTable pointers, function pointers, calling class member functions using function pointers derived from VPtrs, and the like...
http://www.jose.it-berater.org/smffo...hp?board=362.0
http://www.daniweb.com/forums/thread144510.html
Also, here's a link to some of my tutorials using C, C++ and PowerBASIC where I pretty much take COM memory apart and look close at VTables, VTable pointers, function pointers, calling class member functions using function pointers derived from VPtrs, and the like...
http://www.jose.it-berater.org/smffo...hp?board=362.0
Last edited by Frederick2; Aug 30th, 2009 at 5:43 pm.
•
•
Join Date: Jul 2008
Posts: 134
Reputation:
Solved Threads: 14
•
•
•
•
( (void (*)()) vptr[0] )();
((void(*)())
is a cast prefaced in front of this function pointer call...
vptr[0] )();
The function pointer call is calling a function at this address...
vptr[0]
...and the function itself is such that it takes no parameters, i.e., 'void', and returns nothing, i.e., return is void.
The cast in front of this function address is simply necessary to inform the compiler that,
a) it is a function pointer call that returns void;
b) it uses __cdecl;
c) it is a function pointer call and there are no parameters.
![]() |
Similar Threads
- VB: Connect to Access database via ODBC datasource name (Visual Basic 4 / 5 / 6)
- Question on how to connect MS access database to C program (C)
- Unhandled exception and Access violation for every program (C)
- Remote Access/VNC-like Program? (Visual Basic 4 / 5 / 6)
- looking to remove user access to specific program (Windows NT / 2000 / XP)
- request for ansi sql queries equalent to MS access (Visual Basic 4 / 5 / 6)
- Sharing Program folder in peer to peer network (Networking Hardware Configuration)
Other Threads in the C++ Forum
- Previous Thread: gdb cannot acces memory at 0x0
- Next Thread: What can I do better? C++ Homework
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





