Commit 719c3a84 authored by Alexandre Julliard's avatar Alexandre Julliard

Use ioctlsocket() instead of ioctl() so that we can import ws2_32.dll

again (untested).
parent 697bf65e
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
DEFAULT_DEBUG_CHANNEL(winsock); DEFAULT_DEBUG_CHANNEL(winsock);
static INT (WINAPI *WS2_recv)(SOCKET s, char *buf, INT len, INT flags);
/*********************************************************************** /***********************************************************************
* WsControl() * WsControl()
...@@ -184,7 +183,7 @@ DWORD WINAPI WsControl(DWORD protocoll, ...@@ -184,7 +183,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* MAC Address - Let's try to do this in a cross-platform way... */ /* MAC Address - Let's try to do this in a cross-platform way... */
#if defined(SIOCGIFHWADDR) /* Linux */ #if defined(SIOCGIFHWADDR) /* Linux */
strcpy(ifInfo.ifr_name, ifName); strcpy(ifInfo.ifr_name, ifName);
if (ioctl(sock, SIOCGIFHWADDR, &ifInfo) < 0) if (ioctlsocket(sock, SIOCGIFHWADDR, (ULONG*)&ifInfo) < 0)
{ {
ERR ("Error obtaining MAC Address!\n"); ERR ("Error obtaining MAC Address!\n");
close(sock); close(sock);
...@@ -197,7 +196,7 @@ DWORD WINAPI WsControl(DWORD protocoll, ...@@ -197,7 +196,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
IntInfo->if_physaddrlen=6; IntInfo->if_physaddrlen=6;
} }
#elif defined(SIOCGENADDR) /* Solaris */ #elif defined(SIOCGENADDR) /* Solaris */
if (ioctl(sock, SIOCGENADDR, &ifInfo) < 0) if (ioctlsocket(sock, SIOCGENADDR, (ULONG*)&ifInfo) < 0)
{ {
ERR ("Error obtaining MAC Address!\n"); ERR ("Error obtaining MAC Address!\n");
close(sock); close(sock);
...@@ -697,7 +696,7 @@ int WSCNTL_GetTransRecvStat(int intNumber, unsigned long *transBytes, unsigned l ...@@ -697,7 +696,7 @@ int WSCNTL_GetTransRecvStat(int intNumber, unsigned long *transBytes, unsigned l
INT WINAPI WSARecvEx(SOCKET s, char *buf, INT len, INT *flags) INT WINAPI WSARecvEx(SOCKET s, char *buf, INT len, INT *flags)
{ {
FIXME("(WSARecvEx) partial packet return value not set \n"); FIXME("(WSARecvEx) partial packet return value not set \n");
return WS2_recv(s, buf, len, *flags); return recv(s, buf, len, *flags);
} }
...@@ -709,31 +708,3 @@ void WINAPI WS_s_perror(LPCSTR message) ...@@ -709,31 +708,3 @@ void WINAPI WS_s_perror(LPCSTR message)
FIXME("(%s): stub\n",message); FIXME("(%s): stub\n",message);
return; return;
} }
/***********************************************************************
* WSOCK_LibMain
*/
BOOL WINAPI WSOCK_LibMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
{
static HMODULE ws2_32;
switch (reason)
{
case DLL_PROCESS_ATTACH:
/* we import ws2_32 by hand, because we don't want to implicitly */
/* link to it; otherwise Unix calls like socket() get redirected */
/* to ws2_32.dll and this is not what we want. */
if (!(ws2_32 = LoadLibraryA( "ws2_32.dll" )))
{
ERR("could not load ws2_32\n" );
return FALSE;
}
WS2_recv = (void *)GetProcAddress( ws2_32, "recv" );
break;
case DLL_PROCESS_DETACH:
FreeLibrary( ws2_32 );
break;
}
return TRUE;
}
name wsock32 name wsock32
type win32 type win32
init WSOCK_LibMain
import kernel32.dll import ws2_32.dll
import ntdll.dll import ntdll.dll
debug_channels (winsock) debug_channels (winsock)
......
...@@ -214,6 +214,7 @@ BOOL WINAPI WSACloseEvent(WSAEVENT event); ...@@ -214,6 +214,7 @@ BOOL WINAPI WSACloseEvent(WSAEVENT event);
SOCKET WINAPI WSASocketA(int af, int type, int protocol, SOCKET WINAPI WSASocketA(int af, int type, int protocol,
LPWSAPROTOCOL_INFOA lpProtocolInfo, LPWSAPROTOCOL_INFOA lpProtocolInfo,
GROUP g, DWORD dwFlags); GROUP g, DWORD dwFlags);
extern INT WINAPI ioctlsocket(SOCKET s, LONG cmd, ULONG *argp);
#include "poppack.h" #include "poppack.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment