[API]
gethostbyname
RtlMoveMemory
GetVersion

[INCLUDE]
Winsock
UIntAddUInt

[CODE]
Public Function Winsock_GetHostByName(ByVal xHostname As String) As Long
  Dim xLong1 As Long
  Dim xLong2 As Long
  
  xLong1 = gethostbyname(xHostname)
  If Not xLong1 = 0& Then
    If (GetVersion And &H80000000) = &H0 Then
      UIntAddUInt xLong1, 12&
      Call RtlMoveMemory(ByVal VarPtr(xLong2), ByVal xLong1, 4&)
      If Not xLong2 = 0& Then
        Call RtlMoveMemory(ByVal VarPtr(xLong1), ByVal xLong2, 4&)
        If Not xLong1 = 0& Then
          Call RtlMoveMemory(ByVal VarPtr(xLong2), ByVal xLong1, 4&)
          Winsock_GetHostByName = xLong2
          End If
        End If
      Else
      UIntAddUInt xLong1, 16&
      Call RtlMoveMemory(ByVal VarPtr(xLong2), ByVal xLong1, 4&)
      If Not xLong2 = 0& Then
        Call RtlMoveMemory(ByVal VarPtr(xLong1), ByVal xLong2, 4&)
        Winsock_GetHostByName = xLong1
        End If
      End If
    End If
  End Function