Example #1
0
    def wprintf(self, proc, argv, ctx={}):

        arch = proc.get_arch()
        if arch == UC_ARCH_X86:
            fmt, va_list = ApiHandler.get_argv(proc, cv.CALL_CONV_CDECL, 2)[:2]
        else:
            raise Exception("Unsupported architecture")

        rv = 0

        fmt_str = common.read_wide_string(proc.uc_eng, fmt)
        fmt_cnt = self.get_va_arg_count(fmt_str)

        vargs = self.va_args2(fmt_cnt)
        fin = common.make_fmt_str(proc, fmt_str, vargs, True)

        rv = len(fin)
        argv.append(fin)

        # print(fin)

        return rv
Example #2
0
    def __stdio_common_vfprintf(self, proc, argv, ctx={}):

        arch = proc.get_arch()
        if arch == UC_ARCH_X86:
            opts, opts2, stream, fmt, _, va_list = ApiHandler.get_argv(
                proc, cv.CALL_CONV_CDECL, 6)[:6]
        else:
            raise Exception("Unsupported architecture")

        rv = 0

        fmt_str = common.read_mem_string(proc.uc_eng, fmt, 1)
        fmt_cnt = self.get_va_arg_count(fmt_str)

        vargs = self.va_args(va_list, fmt_cnt)
        fin = common.make_fmt_str(proc, fmt_str, vargs)

        argv[:] = [opts, stream, fin]

        # print(fin)

        rv = len(fin)

        return rv