mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed the way send and recv are called and return errors.
added some printing. dllmains: adjusted printing. svn path=/trunk/; revision=10995
This commit is contained in:
parent
18318e6e17
commit
d0135b1184
4 changed files with 36 additions and 8 deletions
|
@ -9,6 +9,7 @@
|
|||
* CSH 01/09-2000 Created
|
||||
* Alex 16/07/2004 - Complete Rewrite
|
||||
*/
|
||||
#include <roscfg.h>
|
||||
#include <string.h>
|
||||
#include <msafd.h>
|
||||
#include <helpers.h>
|
||||
|
@ -119,6 +120,10 @@ WSPSocket(
|
|||
Socket->SharedData.UseSAN = FALSE;
|
||||
Socket->SanData = NULL;
|
||||
|
||||
/* Ask alex about this */
|
||||
if( Socket->SharedData.SocketType == SOCK_DGRAM )
|
||||
Socket->SharedData.ServiceFlags1 |= XP1_CONNECTIONLESS;
|
||||
|
||||
/* Packet Size */
|
||||
SizeOfPacket = TransportName.Length + sizeof(AFD_CREATE_PACKET) + sizeof(WCHAR);
|
||||
|
||||
|
|
|
@ -317,6 +317,8 @@ WSPSend(
|
|||
PVOID APCFunction;
|
||||
HANDLE Event;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Called\n"));
|
||||
|
||||
/* Set up the Send Structure */
|
||||
SendInfo.BufferArray = (PAFD_WSABUF)lpBuffers;
|
||||
SendInfo.BufferCount = dwBufferCount;
|
||||
|
@ -384,11 +386,14 @@ WSPSend(
|
|||
}
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
return WSA_IO_PENDING;
|
||||
AFD_DbgPrint(MID_TRACE,("Leaving (Pending)\n"));
|
||||
return WSA_IO_PENDING;
|
||||
}
|
||||
|
||||
/* Return Number of bytes Sent */
|
||||
*lpNumberOfBytesSent = (DWORD)IOSB->Information;
|
||||
*lpNumberOfBytesSent = (DWORD)IOSB->Information;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Leaving (Success, %d)\n", IOSB->Information));
|
||||
|
||||
/* Success */
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
/* See debug.h for debug/trace constants */
|
||||
DWORD DebugTraceLevel = MIN_TRACE;
|
||||
//DWORD DebugTraceLevel = MAX_TRACE;
|
||||
|
||||
#endif /* DBG */
|
||||
|
||||
|
@ -286,12 +287,21 @@ closesocket(
|
|||
|
||||
CloseProviderHandle((HANDLE)s);
|
||||
|
||||
WS_DbgPrint(MAX_TRACE,("DereferenceProviderByHandle\n"));
|
||||
|
||||
DereferenceProviderByPointer(Provider);
|
||||
|
||||
WS_DbgPrint(MAX_TRACE,("DereferenceProviderByHandle Done\n"));
|
||||
|
||||
Status = Provider->ProcTable.lpWSPCloseSocket(s, &Errno);
|
||||
|
||||
WS_DbgPrint(MAX_TRACE,("Provider Close Done\n"));
|
||||
|
||||
if (Status == SOCKET_ERROR)
|
||||
WSASetLastError(Errno);
|
||||
|
||||
WS_DbgPrint(MAX_TRACE,("Returning success\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ recv(
|
|||
IN INT len,
|
||||
IN INT flags)
|
||||
{
|
||||
DWORD Error;
|
||||
DWORD BytesReceived;
|
||||
WSABUF WSABuf;
|
||||
|
||||
|
@ -34,9 +35,9 @@ recv(
|
|||
WSABuf.len = len;
|
||||
WSABuf.buf = (CHAR FAR*)buf;
|
||||
|
||||
WSARecv(s, &WSABuf, 1, &BytesReceived, (LPDWORD)&flags, NULL, NULL);
|
||||
Error = WSARecv(s, &WSABuf, 1, &BytesReceived, (LPDWORD)&flags, NULL, NULL);
|
||||
|
||||
return BytesReceived;
|
||||
if( Error ) return -1; else return BytesReceived;
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,6 +54,7 @@ recvfrom(
|
|||
OUT LPSOCKADDR from,
|
||||
IN OUT INT FAR* fromlen)
|
||||
{
|
||||
DWORD Error;
|
||||
DWORD BytesReceived;
|
||||
WSABUF WSABuf;
|
||||
|
||||
|
@ -62,9 +64,9 @@ recvfrom(
|
|||
WSABuf.len = len;
|
||||
WSABuf.buf = (CHAR FAR*)buf;
|
||||
|
||||
WSARecvFrom(s, &WSABuf, 1, &BytesReceived, (LPDWORD)&flags, from, fromlen, NULL, NULL);
|
||||
Error = WSARecvFrom(s, &WSABuf, 1, &BytesReceived, (LPDWORD)&flags, from, fromlen, NULL, NULL);
|
||||
|
||||
return BytesReceived;
|
||||
if( Error ) return -1; else return BytesReceived;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,6 +82,7 @@ send(
|
|||
IN INT flags)
|
||||
{
|
||||
DWORD BytesSent;
|
||||
DWORD Error;
|
||||
WSABUF WSABuf;
|
||||
|
||||
WS_DbgPrint(MAX_TRACE, ("s (0x%X) buf (0x%X) len (0x%X) flags (0x%X).\n",
|
||||
|
@ -88,7 +91,9 @@ send(
|
|||
WSABuf.len = len;
|
||||
WSABuf.buf = (CHAR FAR*)buf;
|
||||
|
||||
return WSASend(s, &WSABuf, 1, &BytesSent, flags, NULL, NULL);
|
||||
Error = WSASend(s, &WSABuf, 1, &BytesSent, flags, NULL, NULL);
|
||||
|
||||
if( Error ) return -1; else return BytesSent;
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,6 +110,7 @@ sendto(
|
|||
IN CONST struct sockaddr *to,
|
||||
IN INT tolen)
|
||||
{
|
||||
DWORD Error;
|
||||
DWORD BytesSent;
|
||||
WSABUF WSABuf;
|
||||
|
||||
|
@ -114,7 +120,9 @@ sendto(
|
|||
WSABuf.len = len;
|
||||
WSABuf.buf = (CHAR FAR*)buf;
|
||||
|
||||
return WSASendTo(s, &WSABuf, 1, &BytesSent, flags, to, tolen, NULL, NULL);
|
||||
Error = WSASendTo(s, &WSABuf, 1, &BytesSent, flags, to, tolen, NULL, NULL);
|
||||
|
||||
if( Error ) return -1; else return BytesSent;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue