Skip to main content
GameDev.net gamedev.net
🔒 Locked

Completion Port Issue?

Started by RITZ Dec 12, 2005 at 4:47 PM 0 replies 800+ views
Original Post
RITZ
RITZ
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.
RITZ
RITZ
Is bumping allowed? ;)

There is something that WSARecv does to the thread in which it is called that I need to take and carry over to the thread that it should have been called in, and the victim process thinks it was called in... I know it has something to do with alertable states and/or completion routines being called. I could really use some insight.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.