private static byte[] GenerateDetourOpCodes(IntPtr hookAddress) { // retn sets eip to the the top of the stack -> hook function is being called. var assembler = new X86Assembler(); assembler.Push(hookAddress); assembler.Retn(); return assembler.GetBytes(); }