
4 Weeks Ago
|
 | Master Sergeant | | | Join Date: Mar 2009 Location: /
Posts: 84
Reputation: 15 Level up: 50%, 250 Points needed |   | |
| ASM Hooplah Hey, i'm currently buggering around with asm and registering lua functions but my asm is wrong. I could really do with a hand sorting it out.
Basically I am trying to create a function inside wow which stores a value in a predetermined area of memory.
e.g. something analogous to: Code: int MyVar;
void MyFunc(int i)
{
MyVar = i;
}
My current LUA function looks like this Code:
Asm.AddLine("push ebp");
Asm.AddLine("mov ebp, esp");
Asm.AddLine("sub esp, 0xC0");
Asm.AddLine("push ebx");
Asm.AddLine("push esi");
Asm.AddLine("push edi");
Asm.AddLine("lea edi, [ebp-0xC0]");
Asm.AddLine("mov ecx, 0x30");
Asm.AddLine("mov eax, 0x0CCCCCCCC");
Asm.AddLine("rep stosd");
Asm.AddLine("mov eax, [ebp+0x8]");
Asm.AddLine("mov [" + pMyVar + "], eax");
Asm.AddLine("pop edi");
Asm.AddLine("pop esi");
Asm.AddLine("pop ebx");
Asm.AddLine("mov esp, ebp");
Asm.AddLine("pop ebp");
Asm.AddLine("retn"); Once regestered I can call the function fine. /console MyFunc 1 //set MyVar to 1
But it's not actually storing the variable as I would like it to.
Instead it seems to be storing a new location in MyVar:
0x012A2168;
This appears to store the last thing typed into the console i.e. "MyFunc"
Can anyone spot the error in my asm?
Thanks very much.
Last edited by FenixTX2; 4 Weeks Ago at 08:09 PM.
|