Hum. Then there is a problem elsewhere. Also what is the difference between Absolute and Relative? Is it relative to the function starting point vs Absolute relative to the module base?
The value returned by Bytes being read from the wrong memory location.
EDIT2: byte[] bytes = MemoryIn.ReadBytes(memory, 0x04, true); // Is instant C# crash.
EDIT3: Still dont get how it works. The value I need is pointed to by EAX 'ASCII "15"'. The final call before ending the GetLocalizedText sets EAX. If I set the Delegate to type string (was worth a try) it crashes upon registering the callback.
EDIT4: No matter how I arrange it.. always crash on byte[] bytes = MemoryIn.ReadBytes(memory, 0x50, true);
EDIT5: I basically just need to extract the value from EAX before it returns. How to do?
EX:
Code:
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate void LuaGetTextDelegate(
IntPtr @this, out IntPtr instance, int minone);
private static LuaGetTextDelegate GetLocalizedText;
Marshal.Copy(data, 0, memory, data.Length);
Marshal.WriteByte(memory + data.Length, 0);
GetLocalizedText(InProcGetActivePlayer(), out memory, -1);
byte[] bytes = MemoryIn.ReadBytes(memory, 0x50, true);
Code:
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private delegate int LuaGetTextDelegate(
IntPtr @instance2, IntPtr instance, int minone);
private static LuaGetTextDelegate GetLocalizedText;
public static string LUA_GetLocalizedText(string query)
{
string sResult;
var data = Encoding.ASCII.GetBytes(query);
var memory = Marshal.AllocHGlobal(data.Length + 1);
try
{
Marshal.Copy(data, 0, memory, data.Length);
Marshal.WriteByte(memory + data.Length, 0);
GetLocalizedText(InProcGetActivePlayer(), memory, -1);
byte[] bytes = MemoryIn.ReadBytes(memory, 0x50); //problem here
sResult = Encoding.ASCII.GetString(bytes, 0, bytes.Length + 1);
}
finally
{
Marshal.FreeHGlobal(memory);
}
return sResult;
}
Code:
//Must be incorrectly passing ECX? probably the first @IntPtr as an arg is wrong?
//Not Working Stack :(
07BEA818 0FE55F06 RETURN to 0FE55F06
07BEA81C 2885FD38 ASCII "freeslots"
07BEA820 FFFFFFFF
07BEA824 5A5537F6 //This was not a problem before.
07BEA828 647C5D60 clr.647C5D60
07BEA82C 07BEA9DC
//Working Stack
006BFAB4 0CDF0014 RETURN to 0CDF0014 from Wow.012BD7F0
006BFAB8 0CCA0000 ASCII "freeslots"
006BFABC FFFFFFFF
006BFAC0 0CCB0017 RETURN to 0CCB0017
006BFAC4 00000000
006BFAC8 03A28678
006BFACC 006BFAE8
D3 Easter Egg? :P. I believe that's sometimes seen as a value in AnimPreplayData?
Originally Posted by
Apoc