| View previous topic :: View next topic |
| Author |
Message |
booingthetroll Expert Cheater
Reputation: 0
Joined: 30 Aug 2011 Posts: 114 Location: ::1
|
Posted: Mon Apr 30, 2012 4:11 pm Post subject: Autoassemble.dll? |
|
|
| If I were to write a trainer in C# that would write jmp [specific address] to somewhere, then how would I do it? From what I have seen, every time you put it at a different location, the bytes change... What and where is autoassemble.dll? Should I use that? I would be using C#.
|
|
| Back to top |
|
 |
Innovation Grandmaster Cheater
Reputation: 12
Joined: 14 Aug 2008 Posts: 617
|
Posted: Mon Apr 30, 2012 7:10 pm Post subject: |
|
|
The operand for JMP is the relative offset added to the instruction pointer (after JMP completes) to get to new location.
Example:
0x00400000 - 0xEB 0x1E - JMP 0x00400020
0xEB stands for an 8-bit relative JMP, and 0x1E is the offset (0x20 - sizeof(JMP rel8)).
See http://ref.x86asm.net/ for other opcodes.
|
|
| Back to top |
|
 |
Pingo Grandmaster Cheater
Reputation: 8
Joined: 12 Jul 2007 Posts: 571
|
Posted: Tue May 01, 2012 5:25 am Post subject: |
|
|
I just made this now, tested it in my memory class, works fine.
Len <- the length to the next instruction atleast 5 bytes away, the rest gets nopped.
DoJump <- Put true for jump, Put false for call
| Code: | public byte[] JmpCall(IntPtr Cave, int JumpFrom, int Len, bool DoJump)
{
if (Len < 5) return null;
byte[] tmp = BitConverter.GetBytes((int)Cave - JumpFrom - 5);
byte[] byts = new byte[Len];
byts[0] = DoJump ? (byte)0xE9 : (byte)0xE8;
for (int i = 1; i < byts.Length; i++)
{
byts[i] = i < 5 ? tmp[i - 1] : (byte)0x90;
}
return byts;
} |
But this is only to get to the cave. You'l still need to make something to return or jump back from the cave to the next instruction.
It would be reversed for jumping back. NextInstruc - Cave - 5
Cave location would be (Cave + Length of injection)
NextInstruc location would be (JumpFrom + Len)
_________________
|
|
| Back to top |
|
 |
|