0

I am currently working on Visual C++ and I have a problem with lea.

My code is the following :

char * txt = (char *) malloc(19);
__asm {
    lea eax, [ text ]
    xor ebx, ebx
    mov [eax + ebx], '3'
}

When I run it, I have the following values after the lea instruction :

name :       value :
 text         0x00346550
 eax          0x0012fe78

I would have liked eax to have the same value as text to insert elements.

Thank you for your answers. =)

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43
Betcha
  • 155
  • 3
  • 12
  • 1
    What if you change `lea` to `mov`? That's probably what you want. – Ian Abbott Mar 01 '18 at 16:34
  • It work,I tested this before: `mov eax, text` and I had an error – Betcha Mar 01 '18 at 17:05
  • Please do not add the solution to your question. If you found a solution that worked best for you, then you can accept it below or answer your own question. This site encourages multiple solutions from other users, as the one that worked best for you may not work the best for someone else. Your question has been rolled back to its previous state. For more information, please visit the [help]. – K.Dᴀᴠɪs Mar 01 '18 at 17:09

0 Answers0