Skip to content

在hook不定长参数函数(比如:printf)时,代理函数如何调用原始函数? #62

Answered by caikelun
Mr-JingShi asked this question in Q&A
Discussion options

You must be logged in to vote

两种情况:

  1. 可变部分的参数最大个数可知:按照最大参数个数来定义proxy和传参,可参考 bytehook_sample 中对 open 的 hook。
  2. 可变部分的参数最大个数不可知:通过对应的 va_list 参数版本的函数调用“原函数”,比如 print 的 proxy 中调用 vprintf

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mr-JingShi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issue Good for newcomers
2 participants