Original Post
I have an injected dll in a foreign process and I'm hooking many Winsock functions because the core functionality of this program is basically a packet sniffer. Well, I have an issue where I must be able to terminate a blocking receive operation on a socket. After several attempts I decided the only possible way was to encapsulate the actual call to the Winsock function inside a little thread stub and create the thread with CreateThread then WaitForSingleObjectEx to wait for the thread to exit by means of the function returning or the thread being terminated via a map of sockets to thread handles and acting on the exit code. Well, this works fine and dandy with recv/recvfrom, but afterwards when I got around to implementing the whole system with WSARecv/WSARecvFrom I had some issues when testing on Internet Explorer (pages aren't being received). Nothing seems to fail, but what I think is happening that I came to as a result of trial and error with a bunch of testbeds, is that completion routines aren't being called for some reason. I am not sure of this, so I graciously accept ANY ideas as to why I am having issues only when I make the actual call from another thread. I can virtually replace CreateThread with WSARecv and it work. I've rigorously looked over my code for stupid mistakes and there are absolutely none. This only happens when I take the call out of its thread. Thanks for any advice, or solutions in advance. And sorry for the allegedly lengthy post.