Finding out a class size(the class is inside a host process)

Started by
1 comment, last by xilup 14 years, 1 month ago
I am trying to modify Gothic 2 just fo fun. I am having the addresses of the classes, the constructors, deconstructors, but i need to know how to find out the size of a class(e.g. oCNpc).To find out the classes' address i am using IDA. The reason for this is that i want to create my own instances of that classes, but to do so i need to allocate some memory(size = sizeof(class)) mov the pointer to ECX then call the class' constructor. --xilup
Advertisement
Put a breakpoint on the constructor. When it gets hit, hopefully it is the result of a dynamic allocation (malloc/new). Look up the stack to find the call to malloc, and check the argument, which should tell you the number of bytes.
Quote:Original post by cache_hit
Put a breakpoint on the constructor. When it gets hit, hopefully it is the result of a dynamic allocation (malloc/new). Look up the stack to find the call to malloc, and check the argument, which should tell you the number of bytes.


Perfect!Thank you, it worked!

This topic is closed to new replies.

Advertisement