So I'm stumped (and still new), so I thought I'd throw this out there. I've been setting up my framework and encountered The Strange(tm). About 30% of the code is your tasty copypasta, for the parts that I dont fully understand (I cant write assembly yet).
The code for calling VMT 47 was pulled from wowbasic2.0, and I just updated the VMT GetName offset per Cyphers post to 0x2f. I also updated the AllocateMemory to 0x1000 - per a suggestion I read on Shynds blog (I'm pretty sure it was Synds blog, its all a blur, been reading a ton).
Code:
public static object GetName(cObject Obj)
{
Trace.WriteLine(string.Format("Getting name for GUID: {0}", Obj.GUID));
ProcessMemory memory = Obj.Owner.Memory;
int number = memory.AllocateMemory(0x1000);
Clipboard.SetText(Conversion.Hex(number));
int num2 = number + 100;
int num = number + 200;
int vTableFuncPtr = Obj.GetVTableFuncPtr(0x2f);
int num4 = number + 300;
string asmStr = "8B-15-18-33-D4-00-8B-92-18-22-00-00-64-A1-2C-00-00-00-3E-8B-00-05-08-00-00-00-3E-89-10-8B-0D-I1-FF-15-I2-89-05-I3-C3";
asmStr = asmStr.Replace("I1", BitConverter.ToString(BitConverter.GetBytes(num))).Replace("I2", BitConverter.ToString(BitConverter.GetBytes(num2))).Replace("I3", BitConverter.ToString(BitConverter.GetBytes(num4)));
memory.WriteInt32(num2, vTableFuncPtr);
memory.WriteInt32(num, Obj.BaseAddress);
memory.WriteBytes(number, StrToBytes(asmStr));
memory.CallFunction(number);
int address = memory.ReadInt32(num4);
return memory.ReadString(address, 0x20);
}
CallFunction, also ripped from wowobasic2.0
Code:
internal void CallFunction(int FuncAddress)
{
int hObj = _CreateRemoteThread(hProcess, 0, 0, FuncAddress, 0, 0, 0);
WaitForSingleObject(hObj, 0x2710);
CloseHandle(hObj);
}
What is interesting, is that after updating the offset, it worked great, and did for a couple days. Then all of a sudden, it starts throwing a memory read exception in WoW. I thinker with things (blindly for the most part), then its working again. Then its not. Its not a consistent failure which worries me.
I also threw in a trace write to confirm is always the same object being checked, and it indeed is.
Code:
ERROR #132 (0x85100084) Fatal Exception
Program: C:\Program Files\World of Warcraft\WoW.exe
Exception: 0xC0000005 (ACCESS_VIOLATION) at 0023:06480006
The instruction at "0x06480006" referenced memory at "0xEB7B008E".
The memory could not be "read".
I could do without being able to access this function, but I'd like to be able to use other VMT methods as well - can anyone point me in the right direction to investigate? Or maybe just tell me whats going on here? Clearly its trying to read where it shouldnt, but why shouldnt it?
Too bad I ordered Reversing with painfully-slow 'Super Saver Shipping' lol
Oh, and I <3 IDA (even though I dont know how to really take advantage of it yet)