0

I have a simple C++ program compiled with Visual Studio 2005. I know that this program has a class base with a member variable x.

How can I identify the variable x when looking at the x86? Here is a function of this binary.

  • Do you know the language in which this program was written? – Dillinur Dec 4 '15 at 21:36
  • @Dillinur yes its C++ visual studio 2005, but i dont have any additional info like pdb or Coff, here is the source - pseudo code pastebin.com/5NLDV3S1 , asm pastebin.com/GRuJWSm6 – LighFusion Dec 4 '15 at 21:41
2

For Visual Studio, ecx usually points to the current this object. As you can see, it's placed in esi at the start of your program.

.text:1090B641 mov esi, ecx

esi is not modified elsewhere, and is always used to access variables with offsets. That should indicate to you that it's the address of a struct, and each offset points to a given variable.

.text:1090B651 mov dword ptr [esi], offset off_10959BE4

.text:1090B660 mov [esi+1Ch], eax

.text:1090B663 mov [esi+10h], eax

.text:1090B666 mov [esi+3Ch], ebx

.text:1090B669 mov [esi+38h], ebx

.text:1090B66C mov [esi+40h], ebx

.text:1090B66F mov byte ptr [esi+44h], 0ACh

You'll have to find the purpose of each of those variables by looking at their size and how they are used in your program. In order to help you with that, you can define a new struct in Ida by going in the Structs tab (Shift+F9), and defining a new struct with variables corresponding to those offsets. You can then map them with T to help you following them.

See for instance this blog post.

  • thx a lot, i will try to do that. – LighFusion Dec 4 '15 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.