Sign in to follow this  
xilup

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

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this