What is a lea statement before a method call?

Looking at my parsed code, I see a lot of the following:

00B442E9 push 4 00B442EB push 3 00B442ED lea ecx,[ebp-24h] 00B442F0 call Foo::Bar (0B41127h) 

I understand that pressing parameters before the call, but what does lea do here?

+6
source share
2 answers

In the thiscall calling standard used by Visual C ++ for x86, the this pointer is passed in the ecx . This lea command copies the this pointer to the ecx before calling the member function.

You can read all lea instructions in the question What is the purpose of the LEA instruction?

+11
source

I think this is just an optimized form

 mov ecx, ebp sub ecx, 24h 
+2
source

Source: https://habr.com/ru/post/894242/


All Articles