local ffi = require('ffi')
ffi.cdef [[
int VirtualProtect(void* lpAddress, unsigned long dwSize, unsigned long flNewProtect, unsigned long* lpflOldProtect);
]]
function main()
local old_prot = ffi.new('unsigned long[1]')
ffi.C.VirtualProtect(ffi.cast('void*', 0x5700F7), 10, 0x40, old_prot)
ffi.cast('uint8_t*', 0x5700F7)[0] = 0xB8
ffi.copy(ffi.cast('void*', 0x5700FB), ffi.cast('void*', ffi.cast('unsigned char*', '\x89\x96\xBC\x00\x00\x00')), 6)
ffi.C.VirtualProtect(ffi.cast('void*', 0x5700F7), 10, old_prot[0], old_prot)
ffi.C.VirtualProtect(ffi.cast('void*', 0x570103), 1, 0x40, old_prot)
ffi.cast('uint8_t*', 0x570103)[0] = 0xEB
ffi.C.VirtualProtect(ffi.cast('void*', 0x570103), 1, old_prot[0], old_prot)
end