将数据本地填充到recv-Buffer中 [英] Fill data into the recv-Buffer locally
问题描述
我迷上了Windows中的send
和recv
函数.在某些情况下,我会修改将要发送和读取的数据.在send
函数中,这很容易.我迷上了函数,修改了源缓冲区,然后将其传递给原始函数.但是对于recv
函数,这更加复杂.当我调用原始的recv
函数并决定添加更多数据时,我需要将数据推送到本地队列中,以便下次调用recv
时将返回这些字节.有什么想法吗?
I hook into the send
and recv
functions in Windows. In some situations I modify the data that's going to be sent and read. In the send
function, this is easy. I hook into the function, modify the source buffer and then pass it to the original function. But for the recv
function, this is more complicated. When I've called the original recv
function and I'm going to decide to add more data, I need to push data into the local queue so that the next call of recv
would return those bytes. Any ideas on that?
推荐答案
您的过滤器方法应调用recv(),然后将数据添加到缓冲区的末尾,调整返回的读取计数,然后将其返回.无需将数据推入本地队列".
Your filter method should call recv() and then add your data to the end of the buffer, adjust the read count returned, and return it. No need to 'push data into the local queue'.
这篇关于将数据本地填充到recv-Buffer中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!