Since I'm not able to get the LUA return values (missing reversing / coding) skillz, I'm trying to call the function and get the return values from there.
IsSpellUsable (ASM)
Code:
.text:00700760 sub_700760 proc near ; DATA XREF: .data:00A41C8Co
.text:00700760
.text:00700760 var_2C0 = qword ptr -2C0h
.text:00700760 var_2AC = dword ptr -2ACh
.text:00700760 var_C = dword ptr -0Ch
.text:00700760 var_8 = dword ptr -8
.text:00700760 var_4 = dword ptr -4
.text:00700760 arg_0 = dword ptr 8
.text:00700760
.text:00700760 push ebp
.text:00700761 mov ebp, esp
.text:00700763 sub esp, 2ACh
.text:00700769 push ebx
.text:0070076A push esi
.text:0070076B mov esi, [ebp+arg_0]
.text:0070076E push edi
.text:0070076F push 1
.text:00700771 push 0
.text:00700773 lea edi, [ebp+var_8]
.text:00700776 lea ebx, [ebp+var_4]
.text:00700779 mov [ebp+var_4], 0
.text:00700780 call sub_6FF810
.text:00700785 add esp, 8
.text:00700788 test eax, eax
.text:0070078A jnz short loc_700793
.text:0070078C pop edi
.text:0070078D pop esi
.text:0070078E pop ebx
.text:0070078F mov esp, ebp
.text:00700791 pop ebp
.text:00700792 retn
My C# code (with fasm managed)
Code:
//Refresh curMgr code
UpdateManager();
Asm.AddLine("mov eax, " + spellId);
Asm.AddLine("push eax");
Asm.AddLine("call " + 0x00700760);
m_Process.Asm.AddLine("retn");
SuspendThread();
uint result = Asm.InjectAndExecute(cave);
Sadly after executing this code my WoW immediately crashes.
Wow crash log:
pastebin - collaborative debugging tool
Any idea on this?