import struct import ctypes import codecs import windows import windows.k32testing as kernel32proxy import windows.native_exec.simple_x64 as x64 from generated_def.winstructs import * # Special code for syswow64 process CS_32bits = 0x23 CS_64bits = 0x33 def genere_return_32bits_stub(ret_addr): ret_32b = x64.MultipleInstr() ret_32b += x64.Mov('RCX', (CS_32bits << 32) + ret_addr) ret_32b += x64.Push('RCX') ret_32b += x64.Retf32() #32 bits return addr return ret_32b.get_code() # The format of a jump to 64bits mode dummy_jump = "\xea" + struct.pack("