Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 265 of file addrconv.c.
{ INT ErrorCode; PWSSOCKET Socket; DPRINT("WSAHtonl: %p, %lx, %p\n", s, hostlong, lpnetlong); /* Check for WSAStartup */ if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS) { /* Make sure we got a parameter */ if (!lpnetlong) { /* Fail */ SetLastError(WSAEFAULT); return SOCKET_ERROR; } /* Get the Socket Context */ if ((Socket = WsSockGetSocket(s))) { /* Check which byte order to use */ if (Socket->CatalogEntry->ProtocolInfo.iNetworkByteOrder == LITTLEENDIAN) { /* No conversion needed */ *lpnetlong = hostlong; } else { /* Use a swap */ *lpnetlong = DN2H(hostlong); } /* Dereference the socket */ WsSockDereference(Socket); /* Return success */ return ERROR_SUCCESS; } else { /* Set the error code */ ErrorCode = WSAENOTSOCK; } } /* Return with error */ SetLastError(ErrorCode); return SOCKET_ERROR; }