(ql: Qiling, address: int, params)
| 427 | target_txt = None |
| 428 | |
| 429 | def check_print(ql: Qiling, address: int, params): |
| 430 | nonlocal target_txt |
| 431 | ql.os.fcall = ql.os.fcall_select(CDECL) |
| 432 | |
| 433 | params = ql.os.resolve_fcall_params({ |
| 434 | '_Options' : PARAM_INT64, |
| 435 | '_Stream' : POINTER, |
| 436 | '_Format' : STRING, |
| 437 | '_Locale' : DWORD, |
| 438 | '_ArgList' : POINTER |
| 439 | }) |
| 440 | |
| 441 | format = params['_Format'] |
| 442 | arglist = params['_ArgList'] |
| 443 | |
| 444 | count = format.count("%") |
| 445 | fargs = [ql.mem.read_ptr(arglist + i * ql.arch.pointersize) for i in range(count)] |
| 446 | |
| 447 | try: |
| 448 | target_txt = ql.mem.string(fargs[1]) |
| 449 | except: |
| 450 | target_txt = "" |
| 451 | |
| 452 | return address, params |
| 453 | |
| 454 | ql = Qiling(["../examples/rootfs/x86_windows/bin/argv.exe"], "../examples/rootfs/x86_windows") |
| 455 | ql.os.set_api('__stdio_common_vfprintf', check_print, QL_INTERCEPT.ENTER) |
nothing calls this directly
no test coverage detected