def test_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args): target = False pathname = ql.file_des[ftrunc_fd].name.split('/')[-1] if pathname == "test_syscall_ftruncate.txt": print("test => ftruncate(%d, 0x%x)" % (ftrunc_fd, ftrunc_length)) target = True syscall.ql_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args) if target: real_path = ql_transform_to_real_path(ql, pathname) assert os.stat(real_path).st_size == 0x10 os.remove(real_path)
def test_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args): target = False pathname = ql.os.fd[ftrunc_fd].name.split('/')[-1] if pathname == "test_syscall_ftruncate.txt": print("test => ftruncate(%d, 0x%x)" % (ftrunc_fd, ftrunc_length)) target = True syscall.ql_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args) if target: real_path = ql.os.transform_to_real_path(pathname) assert os.stat(real_path).st_size == 0x10 if ql.platform == QL_OS.WINDOWS: return else: os.remove(real_path)
def test_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args): target = False pathname = ql.os.fd[ftrunc_fd].name.split('/')[-1] reg = ql.reg.read("eax") print("reg : 0x%x" % reg) ql.reg.eax = reg if pathname == "test_syscall_ftruncate.txt": print("test => ftruncate(%d, 0x%x)" % (ftrunc_fd, ftrunc_length)) target = True syscall.ql_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args) if target: real_path = ql.os.transform_to_real_path(pathname) assert os.stat(real_path).st_size == 0x10 os.remove(real_path)
def test_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args): target = False pathname = ql.os.fd[ftrunc_fd].name.split('/')[-1] reg = ql.arch.regs.read("eax") print("reg : 0x%x" % reg) ql.arch.regs.eax = reg if pathname == "test_syscall_ftruncate.txt": print("test => ftruncate(%d, 0x%x)" % (ftrunc_fd, ftrunc_length)) target = True regreturn = syscall.ql_syscall_ftruncate(ql, ftrunc_fd, ftrunc_length, *args) if target: real_path = ql.os.path.transform_to_real_path(pathname) assert os.stat(real_path).st_size == 0x10 if ql.host.os != QL_OS.WINDOWS: os.remove(real_path) return regreturn