Blizzhackers

Return of the Jedi

* Login   * Register    * FAQ    * Search

Join us on IRC: #bh@irc.synirc.net (or Mibbit Web IRC)


MuleFactory


It is currently Mon May 20, 2013 5:11 am


All times are UTC [ DST ]





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Blocking packets with detoured WSASend()
PostPosted: Mon Oct 03, 2011 5:43 am 
 
User Gold
User Gold
User avatar

Joined: Mon Dec 02, 2002 8:55 pm
So I have WSASend detoured, and of course can call it to have everything work normally, but some packets (after I analyze them) I want to prevent being sent, so I can't call the original function. The calling code seems to know something's gone awry no matter what I return.

WSASend is supposed to return 0 when everything went ok. The ironic thing is if I simply return 0 when attempting to block, everything goes to hell. If I return -1 (which indicates a socket error), everything isn't as bad but after a certain delay the calling code will create a "hey that packet never got sent!" dialog, then continues on as normal.

What am I supposed to do in my detour if I want to completely block a packet from being sent and pretend everything is ok?

_________________
Peter Griffin, ~esquire~

Top
 Profile  
 Post subject: Re: Blocking packets with detoured WSASend()
PostPosted: Mon Oct 03, 2011 10:18 pm 
 
BHDev
BHDev

Joined: Thu Feb 08, 2007 8:21 pm
int WSASend(
__in SOCKET s,
__in LPWSABUF lpBuffers,
__in DWORD dwBufferCount,
__out LPDWORD lpNumberOfBytesSent,
__in DWORD dwFlags,
__in LPWSAOVERLAPPED lpOverlapped,
__in LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);

lpNumberOfBytesSent [out]
A pointer to the number, in bytes, sent by this call if the I/O operation completes immediately.
Use NULL for this parameter if the lpOverlapped parameter is not NULL to avoid potentially erroneous results. This parameter can be NULL only if the lpOverlapped parameter is not NULL.

Perhaps you're not setting the lpNumberOfBytesSent pointer when you try to return null?

_________________
whiteevil @ jsp
1.13d AutoTele

Top
 Profile  
 Post subject: Re: Blocking packets with detoured WSASend()
PostPosted: Tue Oct 04, 2011 12:52 am 
 
User Gold
User Gold
User avatar

Joined: Mon Dec 02, 2002 8:55 pm
Thanks for the response! I've tried setting the numberofbytesent to either 0 or the full combined len of each WSABUF (to indicate ALL of it was sent) but it seems to have no effect?

I was researching this a bit yesterday and my suspicion is that IOCP (I/O completion ports) is hanging around waiting for a response because of the delayed timeout behavior.

Turns out, after some minor testing, generically blocking a specific wsasend that should have been sent with WPE PRO caused the same delayed error behavior (timed out IOCP request?). If this is the problem, how should I stop this from happening? Should I emulate a fake processed message on the IOCP queue or prevent it from being requested? Also, what specific functions would be of importance in this situation? What does WSASend call internally?

_________________
Peter Griffin, ~esquire~

Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron