Skip to content

Commit

Permalink
ws2_32: Move the getsockopt(IPX_PTYPE) implementation to ntdll.
Browse files Browse the repository at this point in the history
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
  • Loading branch information
zfigura authored and julliard committed Aug 2, 2021
1 parent 9d619b1 commit ce1c5ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
22 changes: 22 additions & 0 deletions dlls/ntdll/unix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 4 additions & 23 deletions dlls/ws2_32/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2158,35 +2158,14 @@ 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;
IPX_ADDRESS_DATA *data;
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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/wine/afd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit ce1c5ff

Please sign in to comment.