user-0 提问: HOOK WSASend

回复:
user: user-0
content: http://blog.csdn.net/rrrfff/article/details/18844699 解决方案

user: user-1
content: C:\windows_2000_source_code\win2k\private\net\sockets\winsock2\dll\winsock2\send.cpp     197: int WSAAPI     198: WSASend(     199:     SOCKET s,     200:     LPWSABUF lpBuffers,     201:     DWORD dwBufferCount,     202:     LPDWORD lpNumberOfBytesSent,     203:     DWORD dwFlags,     204:     LPWSAOVERLAPPED lpOverlapped,     205:     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine     206:     )     207: /*++     208: Routine Description:     209:      210:     Send data on a connected socket.     211:      212: Arguments:     213:      214:     s                   - A descriptor identifying a connected socket.     215:      216:     lpBuffers           - A  pointer  to  an  array of WSABUF structures.  Each     217:                           WSABUF  structure  contains a pointer to a buffer and     218:                           the length of the buffer.     219:      220:     dwBufferCount       - The  number  of  WSABUF  structures  in the lpBuffers     221:                           array.     222:      223:     lpNumberOfBytesSent - A pointer to the number of bytes sent by this call if     224:                           the I/O operation completes immediately.     225:      226:     dwFlags             - Specifies the way in which the call is made.     227:      228:     lpOverlapped        - A  pointer  to a WSAOVERLAPPED structure (ignored for     229:                           non-overlapped sockets).     230:      231:     lpCompletionRoutine - A  pointer  to the completion routine called when the     232:                           send   operation  has  been  completed  (ignored  for     233:                           non-overlapped sockets).     234:      235: Returns:     236:      237:     If  no  error  occurs  and  the  send  operation has completed immediately,     238:     WSASend() returns 0.  Otherwise, a value of SOCKET_ERROR is returned, and a     239:     specific  error  code  may  be retrieved by calling WSAGetLastError().  The     240:     error  code WSA_IO_PENDING indicates that the overlapped operation has been     241:     successfully  initiated  and  that  completion will be indicated at a later     242:     time.  Any other error code indicates that the overlapped operation was not     243:     successfully  initiated  and  no  completion indication will occur.  If the     244:     MSG_INTERRUPT  flag  is set, the meaning of the return value is changed.  A     245:     value  of  zero  indicates  success  and is interpreted as described above.     246:     Otherwise,  the  return  value  will directly contain the appropriate error     247:     code.  Note that this is applicable only to Win16 environments and only for     248:     protocols that have the XP1_INTERRUPT bit set in the WSAPROTOCOL_INFO     249:     struct.     250:      251: --*/     252: {     253:     PDSOCKET           Socket;     254:     INT                ErrorCode;     255:     LPWSATHREADID      ThreadId;     256:      257:     ErrorCode = TURBO_PROLOG_OVLP(&ThreadId);     258:     if (ErrorCode==ERROR_SUCCESS)     259:     {     260:         Socket = DSOCKET::GetCountedDSocketFromSocket(s);     261:         if(Socket != NULL){     262:             INT                ReturnValue;     263:             PDPROVIDER         Provider;     264:      265:             Provider = Socket->GetDProvider();     266:             ReturnValue = Provider->WSPSend(s,     267:                                             lpBuffers,     268:                                             dwBufferCount,     269:                                             lpNumberOfBytesSent,     270:                                             dwFlags,     271:                                             lpOverlapped,     272:                                             lpCompletionRoutine,     273:                                             ThreadId,     274:                                             &ErrorCode);     275:             Socket->DropDSocketReference();     276:             if (ReturnValue==ERROR_SUCCESS)     277:                 return ReturnValue;     278:             assert (ErrorCode!=NO_ERROR);     279:             if (ErrorCode==NO_ERROR)     280:                 ErrorCode = WSASYSCALLFAILURE;     281:         }     282:         else {     283:             ErrorCode = WSAENOTSOCK;     284:         }     285:     }     286:      287:     SetLastError(ErrorCode);     288:     return SOCKET_ERROR;     289: }

user: user-0
content: @VisualEleven

user: user-0
content: @斑竹 @CSDN