From 719c3a84cc369dc1688bd1490acdd98a9cb9842a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 2 Dec 2000 23:46:10 +0000 Subject: [PATCH] Use ioctlsocket() instead of ioctl() so that we can import ws2_32.dll again (untested). --- dlls/wsock32/socket.c | 35 +++-------------------------------- dlls/wsock32/wsock32.spec | 3 +-- include/winsock2.h | 1 + 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/dlls/wsock32/socket.c b/dlls/wsock32/socket.c index 3ed74ee5d42..2259d4ec685 100644 --- a/dlls/wsock32/socket.c +++ b/dlls/wsock32/socket.c @@ -27,7 +27,6 @@ DEFAULT_DEBUG_CHANNEL(winsock); -static INT (WINAPI *WS2_recv)(SOCKET s, char *buf, INT len, INT flags); /*********************************************************************** * WsControl() @@ -184,7 +183,7 @@ DWORD WINAPI WsControl(DWORD protocoll, /* MAC Address - Let's try to do this in a cross-platform way... */ #if defined(SIOCGIFHWADDR) /* Linux */ strcpy(ifInfo.ifr_name, ifName); - if (ioctl(sock, SIOCGIFHWADDR, &ifInfo) < 0) + if (ioctlsocket(sock, SIOCGIFHWADDR, (ULONG*)&ifInfo) < 0) { ERR ("Error obtaining MAC Address!\n"); close(sock); @@ -197,7 +196,7 @@ DWORD WINAPI WsControl(DWORD protocoll, IntInfo->if_physaddrlen=6; } #elif defined(SIOCGENADDR) /* Solaris */ - if (ioctl(sock, SIOCGENADDR, &ifInfo) < 0) + if (ioctlsocket(sock, SIOCGENADDR, (ULONG*)&ifInfo) < 0) { ERR ("Error obtaining MAC Address!\n"); close(sock); @@ -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) { 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) FIXME("(%s): stub\n",message); 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; -} diff --git a/dlls/wsock32/wsock32.spec b/dlls/wsock32/wsock32.spec index cd27d5bec1d..ed3dc93f51c 100644 --- a/dlls/wsock32/wsock32.spec +++ b/dlls/wsock32/wsock32.spec @@ -1,8 +1,7 @@ name wsock32 type win32 -init WSOCK_LibMain -import kernel32.dll +import ws2_32.dll import ntdll.dll debug_channels (winsock) diff --git a/include/winsock2.h b/include/winsock2.h index a473675c08d..96de4d4f9f5 100644 --- a/include/winsock2.h +++ b/include/winsock2.h @@ -214,6 +214,7 @@ BOOL WINAPI WSACloseEvent(WSAEVENT event); SOCKET WINAPI WSASocketA(int af, int type, int protocol, LPWSAPROTOCOL_INFOA lpProtocolInfo, GROUP g, DWORD dwFlags); +extern INT WINAPI ioctlsocket(SOCKET s, LONG cmd, ULONG *argp); #include "poppack.h"