{
/* Duplpicating socket from different process */
if ((HANDLE)lpProtocolInfo->dwServiceFlags3 == INVALID_HANDLE_VALUE)
- return WSAEINVAL;
+ {
+ Status = WSAEINVAL;
+ goto error;
+ }
if ((HANDLE)lpProtocolInfo->dwServiceFlags4 == INVALID_HANDLE_VALUE)
- return WSAEINVAL;
+ {
+ Status = WSAEINVAL;
+ goto error;
+ }
SharedData = MapViewOfFile((HANDLE)lpProtocolInfo->dwServiceFlags3,
FILE_MAP_ALL_ACCESS,
0,
0,
sizeof(SOCK_SHARED_INFO));
if (!SharedData)
- return WSAEINVAL;
+ {
+ Status = WSAEINVAL;
+ goto error;
+ }
InterlockedIncrement(&SharedData->RefCount);
AddressFamily = SharedData->AddressFamily;
SocketType = SharedData->SocketType;
}
if (AddressFamily == AF_UNSPEC && SocketType == 0 && Protocol == 0)
- return WSAEINVAL;
+ {
+ Status = WSAEINVAL;
+ goto error;
+ }
/* Set the defaults */
if (AddressFamily == AF_UNSPEC)
Socket = HeapAlloc(GlobalHeap, 0, sizeof(*Socket));
if (!Socket)
{
- Status = STATUS_INSUFFICIENT_RESOURCES;
+ Status = WSAENOBUFS;
goto error;
}
RtlZeroMemory(Socket, sizeof(*Socket));
Socket->SharedData = HeapAlloc(GlobalHeap, 0, sizeof(*Socket->SharedData));
if (!Socket->SharedData)
{
- Status = STATUS_INSUFFICIENT_RESOURCES;
+ Status = WSAENOBUFS;
goto error;
}
RtlZeroMemory(Socket->SharedData, sizeof(*Socket->SharedData));
EABuffer = HeapAlloc(GlobalHeap, 0, SizeOfEA);
if (!EABuffer)
{
- Status = STATUS_INSUFFICIENT_RESOURCES;
+ Status = WSAENOBUFS;
goto error;
}
if ((SocketType != SOCK_DGRAM) && (SocketType != SOCK_RAW))
{
/* Only RAW or UDP can be Connectionless */
+ Status = WSAEINVAL;
goto error;
}
AfdPacket->EndpointFlags |= AFD_ENDPOINT_CONNECTIONLESS;
if ((Socket->SharedData->ServiceFlags1 & XP1_PSEUDO_STREAM) == 0)
{
/* The Provider doesn't actually support Message Oriented Streams */
+ Status = WSAEINVAL;
goto error;
}
}
if ((Socket->SharedData->ServiceFlags1 & XP1_SUPPORT_MULTIPOINT) == 0)
{
/* The Provider doesn't actually support Multipoint */
+ Status = WSAEINVAL;
goto error;
}
AfdPacket->EndpointFlags |= AFD_ENDPOINT_MULTIPOINT;
|| ((dwFlags & WSA_FLAG_MULTIPOINT_C_LEAF) != 0))
{
/* The Provider doesn't support Control Planes, or you already gave a leaf */
+ Status = WSAEINVAL;
goto error;
}
AfdPacket->EndpointFlags |= AFD_ENDPOINT_C_ROOT;
|| ((dwFlags & WSA_FLAG_MULTIPOINT_D_LEAF) != 0))
{
/* The Provider doesn't support Data Planes, or you already gave a leaf */
+ Status = WSAEINVAL;
goto error;
}
AfdPacket->EndpointFlags |= AFD_ENDPOINT_D_ROOT;
if (!NT_SUCCESS(Status))
{
ERR("Failed to open socket. Status 0x%08x\n", Status);
+ Status = TranslateNtStatusError(Status);
goto error;
}