Module: wine Branch: master Commit: ce1c5ffcaec30af65551a5783bd500f6d02163f4 URL: https://source.winehq.org/git/wine.git/?a=commit;h=ce1c5ffcaec30af65551a5783...
Author: Zebediah Figura z.figura12@gmail.com Date: Fri Jul 30 18:55:36 2021 -0500
ws2_32: Move the getsockopt(IPX_PTYPE) implementation to ntdll.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/socket.c | 22 ++++++++++++++++++++++ dlls/ws2_32/socket.c | 27 ++++----------------------- include/wine/afd.h | 1 + 3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 24090c1a17b..c2cbaff24e1 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1922,6 +1922,28 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc return ret ? sock_errno_to_status( errno ) : STATUS_SUCCESS; }
+#ifdef SOL_IPX + case IOCTL_AFD_WINE_GET_IPX_PTYPE: + return do_getsockopt( handle, io, SOL_IPX, IPX_TYPE, out_buffer, out_size ); +#elif defined(SO_DEFAULT_HEADERS) + case IOCTL_AFD_WINE_GET_IPX_PTYPE: + { + int fd, needs_close = FALSE; + struct ipx value; + socklen_t len = sizeof(value); + int ret; + + if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL ))) + return status; + + ret = getsockopt( fd, 0, SO_DEFAULT_HEADERS, &value, &len ); + if (needs_close) close( fd ); + if (ret) return sock_errno_to_status( errno ); + *(DWORD *)out_buffer = value.ipx_pt; + return STATUS_SUCCESS; + } +#endif + default: { if ((code >> 16) == FILE_DEVICE_NETWORK) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index a28c25ec697..71b5e9a8658 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2158,7 +2158,7 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, return SOCKET_ERROR; } /* end switch(optname) */ }/* end case WS_SOL_SOCKET */ -#ifdef HAS_IPX + case WS_NSPROTO_IPX: { struct WS_sockaddr_ipx addr; @@ -2166,27 +2166,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, int namelen; switch(optname) { - case WS_IPX_PTYPE: - if ((fd = get_sock_fd( s, 0, NULL )) == -1) return SOCKET_ERROR; -#ifdef SOL_IPX - if(getsockopt(fd, SOL_IPX, IPX_TYPE, optval, (socklen_t *)optlen) == -1) - { - ret = SOCKET_ERROR; - } -#else - { - struct ipx val; - socklen_t len=sizeof(struct ipx); - if(getsockopt(fd, 0, SO_DEFAULT_HEADERS, &val, &len) == -1 ) - ret = SOCKET_ERROR; - else - *optval = (int)val.ipx_pt; - } -#endif - TRACE("ptype: %d (fd: %d)\n", *(int*)optval, fd); - release_sock_fd( s, fd ); - return ret; - case WS_IPX_ADDRESS: /* * On a Win2000 system with one network card there are usually @@ -2217,12 +2196,14 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, *(int*)optval = 1; /* As noted under IPX_ADDRESS we have just one card. */ return 0;
+ case WS_IPX_PTYPE: + return server_getsockopt( s, IOCTL_AFD_WINE_GET_IPX_PTYPE, optval, optlen ); + default: FIXME("IPX optname:%x\n", optname); return SOCKET_ERROR; }/* end switch(optname) */ } /* end case WS_NSPROTO_IPX */ -#endif
#ifdef HAS_IRDA #define MAX_IRDA_DEVICES 10 diff --git a/include/wine/afd.h b/include/wine/afd.h index 9a1edb1fda6..6630a6402fc 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -223,6 +223,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_SET_IPV6_UNICAST_IF WINE_AFD_IOC(278) #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)
struct afd_create_params {