That's just how i've done it in C#, the method is a member of my Unit Implementation.
The last line only displays the unitframe of the target
.
Code:
public void Target()
{
string Pattern = "55 8B EC 83 EC 00 E8 00 00 00 00 F7 D8 1B C0";
string Mask = "xxxxx?x????xxxx";
uint CodeLocation = SPattern.FindPattern(_wowLib.iBlackMagic.ProcessHandle, _wowLib.iBlackMagic.MainModule, Pattern, Mask, ' ');
uint codeCave = _wowLib.iBlackMagic.AllocateMemory(0x108);
_wowLib.iBlackMagic.WriteUInt64(codeCave + 0x100, Guid);
_wowLib.iBlackMagic.Asm.Clear();
_wowLib.iBlackMagic.Asm.AddLine("MOV EAX,[0x{0}]",(codeCave + 0x100 + 0x4).ToString("X"));
_wowLib.iBlackMagic.Asm.AddLine("PUSH EAX");
_wowLib.iBlackMagic.Asm.AddLine("MOV EAX,[0x{0}]", (codeCave + 0x100 + 0x0).ToString("X"));
_wowLib.iBlackMagic.Asm.AddLine("PUSH EAX");
_wowLib.iBlackMagic.Asm.AddLine("CALL 0x{0}", CodeLocation.ToString("X"));
_wowLib.iBlackMagic.Asm.AddLine("ADD ESP, 0x08");
_wowLib.iBlackMagic.Asm.AddLine("RETN");
_wowLib.iBlackMagic.Asm.InjectAndExecute(codeCave);
_wowLib.iBlackMagic.FreeMemory(codeCave);
_wowLib.Lua.DoString("ClearTarget(); TargetLastTarget();");
}
Also thanks for the info cenron.
P.S.: Your Pattern should read
Code:
FindPattern("\x55...