Originally Posted by
itCbitC
Perhaps then you need a pointer to store the value inside the EAX register instead of an ordinary variable, as in:
Code:
int *ip;
__asm mov ip, eax;
printf("%X\n", *ip);
Yes, the question is WHEN/WHERE do I read the value from EAX. Obviously I can't put it on top of my main function. (Thanks for the response though, always appreciated.)
Originally Posted by
brewbuck
Can you show a few more instructions prior to this piece of code? Specifically, where is the value of eax coming from?
Sure:
Code:
007E3E00 - 8b 54 24 04 - mov edx,[esp+04]
007E3E04 - 53 - push ebx
007E3E05 - 56 - push esi
007E3E06 - 57 - push edi
007E3E07 - 8d 81 c8 00 00 00 - lea eax,[ecx+000000c8]
007E3E0D - be 07 00 00 00 - mov esi,00000007
007E3E12 - 8b 3a - mov edi,[edx]
007E3E14 - 8b 18 - mov ebx,[eax]
007E3E16 - 03 df - add ebx,edi
007E3E18 - 89 18 - mov [eax],ebx ; // BP
007E3E1A - 79 06 - jns 007e3e22
007E3E1C - c7 00 00 00 00 00 - mov [eax],00000000
007E3E22 - 83 c2 04 - add edx,04
007E3E25 - 83 c0 04 - add eax,04
007E3E28 - 4e - dec esi
007E3E29 - 75 e7 - jne 007e3e12
007E3E2B - e8 60 fd ff ff - call 007e3b90
007E3E30 - 5f - pop edi
007E3E31 - 5e - pop esi
007E3E32 - 5b - pop ebx
007E3E33 - c2 04 00 - ret 0004
After some thoughts, I can also do a move eax, 100000 at 007E3E18. I don't need to read any values from registers that way, however, I'm still interested how that could be achieved.