If nothing else, my thread has a cool title, right? ;-)
I really am quite pleased that I can now read memory to detect bobber splash action in my fishy bot, but naturally... now I want more uberyTime to get in process and do some Interact().
This will me my thread to catalog my learnings for future n00bs.
First, I have been reading the forums on how to pull this off, and this block of code comes up:I figure I should be able to vaguely read that, and as I do... I am gonna tell you what I think it says. That way, you can tell me if I am retarded. and maybe future n00bs can read this for understanding as well.Code://get the adress of the call for vmt 36 (Interact) uint VMT36 = wow.ReadUInt((wow.ReadUInt(obj) + (36 * 4))); wow.Asm.AddLine("fs mov eax, [0x2C]"); wow.Asm.AddLine("mov eax, [eax]"); wow.Asm.AddLine("add eax, 8"); wow.Asm.AddLine("mov dword [eax], {0}", ObjectManager.s_curMgr); wow.Asm.AddLine("mov ecx, {0}", obj); wow.Asm.AddLine("call {0}", VMT36); //read pointer to Interact method wow.Asm.AddLine("retn");
First, it took some mad google skillz to figure out what the hells FS is... apparently it just always points to the TIB for the current thread. Who knew? (bolded so I can some back to it later...)
So, reading that assembly, the way a 1st grader reads MacBeth...
fs mov eax, [0x2c]
I am gonna boldly assume we are not doing a hard deref at 0x2c... so that "fs" must be relevantFreaky syntax. I guess i would have expected
mov eax, fs
add eax, 0x2c
or maybe
mov eax, fs:[0x2c]
but hey... I don't write the stuff, I barely even read it.
So anyway, the googlez says that 0x2c is the offset from TIB to the thread local storage. Sounds good. So we deref that to get the start of TLS into eax.
mov eax, [eax]
So, onto...
add eax, 8
beats me. I mean, sure... 8 away from start of TLS sounds hot. no idea what is there
Let's ignore that and move on...
mov dword [eax], CurrentObjectManagerAddress
Well, alright... wherever eax is pointing (8 away from start of TLS)... we are gonna jam the address of our current object manager. sounds nice. I guess?
Then...
mov ecx, TheObjectAddress
No real comment needed...
Then it's on... like donkey kong...
call VMT36Address
call that dirty skank. We should be able to infer some stuff about that function... me thinks. will come back to that.
retn;
done.
So, apparently this function expects the address of our object to be in ECX. Let's chaulk this up to the non-surprising column, as in c++ land the "this" pointer is typically in ecx. Correct?
Then we get to the two pieces most perplexing the Silly:
- What's with jamming the object manager address into TLS+8?
- Back to my bolded "current thread" madness... my threads TLS doesn't have a darn thing in it. Does it? Wouldn't i have to force this code to run on one of wowz threads?
Now that I see it written, am I answer my own question? Is the point... that the call to Interact is going to expect *my* TLS+8 to point to my object manager, so we jam it in there?
That'd be hot. Any commentary appreciated... while I try to figure out how to actually get this code into wow's process![]()