private void InstallJmp(X86Generator ingen, int hookoff) { _jmp.Clear(); _jmp.SetInstall(ingen.GetInstall()); _jmp.JumpR(_hook + hookoff); _jmp.WriteInstall(_mc2); }
private static int WriteHead(X86Generator gen, X86Generator ingen) { int res = gen.WriteGen(ingen); gen.JumpR(ingen.GetInstall() + ingen.GetCount()); return(res); }
private static void GenPPO(X86Generator gen, IntPtr baseaddr, int codeoff, int stroff) { gen.Clear(); gen.SetInstall(baseaddr + codeoff); gen.PushReg(X86Generator.Registers.ESI); gen.PushR(baseaddr + stroff); }
private static void GenSPM(X86Generator gen, IntPtr baseaddr, int codeoff) { gen.Clear(); gen.SetInstall(baseaddr + codeoff); gen.SubRI(X86Generator.Registers.ESP, 0x28); gen.PushReg(X86Generator.Registers.ESI); gen.MovRR(X86Generator.Registers.ESI, X86Generator.Registers.ECX); }
private static int GenWrap(X86Generator generator, int loading, int dest, short off = 0, byte end = 0x00) { int res = generator.MovByteMIL(loading, 0x01); generator.CallStdL(dest, off); generator.MovByteMIL(loading, end); generator.Retn((short)(off * 4)); return(res); }
// Modifiers public int WriteGen(X86Generator asm) { int res = _data.Count; int delta = _install.ToInt32() + _data.Count - asm._install.ToInt32(); _data.AddRange(asm._data); if (delta == 0) { return(res); } foreach (int addr in asm._adds) { AddOffset(delta, addr + res); } foreach (int addr in asm._subs) { AddOffset(-delta, addr + res); } return(res); }