From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/unix/socket.c | 12 ++++++++++++ dlls/ws2_32/socket.c | 40 +--------------------------------------- include/wine/afd.h | 1 + 3 files changed, 14 insertions(+), 39 deletions(-)
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index c2cbaff24e1..a63209e6ae6 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1925,6 +1925,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc #ifdef SOL_IPX case IOCTL_AFD_WINE_GET_IPX_PTYPE: return do_getsockopt( handle, io, SOL_IPX, IPX_TYPE, out_buffer, out_size ); + + case IOCTL_AFD_WINE_SET_IPX_PTYPE: + return do_setsockopt( handle, io, SOL_IPX, IPX_TYPE, in_buffer, in_size ); #elif defined(SO_DEFAULT_HEADERS) case IOCTL_AFD_WINE_GET_IPX_PTYPE: { @@ -1942,6 +1945,15 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc *(DWORD *)out_buffer = value.ipx_pt; return STATUS_SUCCESS; } + + case IOCTL_AFD_WINE_SET_IPX_PTYPE: + { + struct ipx value = {0}; + + /* FIXME: should we retrieve SO_DEFAULT_HEADERS first and modify it? */ + value.ipx_pt = *(DWORD *)in_buffer; + return do_setsockopt( handle, io, 0, SO_DEFAULT_HEADERS, &value, sizeof(value) ); + } #endif
default: diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 71b5e9a8658..da45734803c 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -825,42 +825,6 @@ convert_socktype_u2w(int unixsocktype) { return -1; }
-static int set_ipx_packettype(int sock, int ptype) -{ -#ifdef HAS_IPX - int fd = get_sock_fd( sock, 0, NULL ), ret = 0; - TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", ptype, fd); - - if (fd == -1) return SOCKET_ERROR; - - /* We try to set the ipx type on ipx socket level. */ -#ifdef SOL_IPX - if(setsockopt(fd, SOL_IPX, IPX_TYPE, &ptype, sizeof(ptype)) == -1) - { - ERR("IPX: could not set ipx option type; expect weird behaviour\n"); - ret = SOCKET_ERROR; - } -#else - { - struct ipx val; - /* Should we retrieve val using a getsockopt call and then - * set the modified one? */ - val.ipx_pt = ptype; - setsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, sizeof(struct ipx)); - } -#endif - release_sock_fd( sock, fd ); - return ret; -#else - WARN("IPX support is not enabled, can't set packet type\n"); - return SOCKET_ERROR; -#endif -} - -/* ----------------------------------- API ----- - * - * Init / cleanup / error checking. - */
/*********************************************************************** * WSAStartup (WS2_32.115) @@ -3453,12 +3417,11 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, } break; /* case WS_SOL_SOCKET */
-#ifdef HAS_IPX case WS_NSPROTO_IPX: switch(optname) { case WS_IPX_PTYPE: - return set_ipx_packettype(s, *(int*)optval); + return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPX_PTYPE, optval, optlen );
case WS_IPX_FILTERPTYPE: /* Sets the receive filter packet type, at the moment we don't support it */ @@ -3471,7 +3434,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, return SOCKET_ERROR; } break; /* case WS_NSPROTO_IPX */ -#endif
/* Levels WS_IPPROTO_TCP and WS_IPPROTO_IP convert directly */ case WS_IPPROTO_TCP: diff --git a/include/wine/afd.h b/include/wine/afd.h index 6630a6402fc..4db6525a7d8 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -224,6 +224,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_GET_IPV6_V6ONLY WINE_AFD_IOC(279) #define IOCTL_AFD_WINE_SET_IPV6_V6ONLY WINE_AFD_IOC(280) #define IOCTL_AFD_WINE_GET_IPX_PTYPE WINE_AFD_IOC(281) +#define IOCTL_AFD_WINE_SET_IPX_PTYPE WINE_AFD_IOC(282)
struct afd_create_params {