-
Active Member
[2.4.3] Having trouble calling DoString from LUA
Warning: ASM noob here
Title had typo: Meant to say calling DoString from ASM not LUA
I know the offset for DoString is Wow.exe+306c80 (also 0x706c80 since tbc does not use ASLR)
I found a function which calls DoString at 0x495ECA
Here is what the function that calls DoString looks like
Here is what DoString looks like in 2.4.3.
I hooked endscene and detoured to my codecave if a flag is on. I turn the flag on after I write to my codecave so it is only executed when my flag is on. I have this part working. The problem is I am having issues calling DoString from my codecave.
This is what I had came up with to try to call DoString from my codecave, but it blows up. I was trying to mimic what the function at 0x495ECA was doing to call DoString.
Code:
String[] asm = new String[]
{
"push 0",
"mov eax, ["+LuaExecuteScriptPtr+"]", //Pointer to null terminated C string with LUA script to be executed
"push eax",
"push eax",
"call 0x706C80", //call LUA DoString
"add esp,12",
"retn",
};
Any hints would be greatly appreciated
Last edited by pinny; 03-11-2017 at 11:07 AM.
-
Active Member
here, you want to push the pointer to the stack, not the first char. I think that should solve it.
Code:
//old "mov eax, ["+LuaExecuteScriptPtr+"]", //Pointer to null terminated C string with LUA script to be executed
"mov eax, "+ LuaExecuteScriptPtr
If your interested here's the function signature: int __cdecl FrameScript__Execute(int a1, int a2, int a3)
Last edited by squiggy; 03-11-2017 at 11:38 AM.
-
Post Thanks / Like - 2 Thanks
pinny,
natt_ (2 members gave Thanks to squiggy for this useful post)
-
Active Member
Originally Posted by
squiggy
here, you want to push the pointer to the stack, not the first char. I think that should solve it.
Code:
//old "mov eax, ["+LuaExecuteScriptPtr+"]", //Pointer to null terminated C string with LUA script to be executed
"mov eax, "+ LuaExecuteScriptPtr
If your interested here's the function signature: int __cdecl FrameScript__Execute(int a1, int a2, int a3)
Thank you so much squiggy I can't believe it was something so stupid!
-
Active Member
an easy mistake to make, glad it got sorted
-
Post Thanks / Like - 2 Thanks
Corthezz,
natt_ (2 members gave Thanks to squiggy for this useful post)