Zebediah Figura : ws2_32: Use IOCTL_AFD_WINE_GET_INFO.
Alexandre Julliard
julliard at winehq.org
Mon Jun 21 16:14:55 CDT 2021
Module: wine
Branch: master
Commit: 5bece995c33d51031c46826c2205c445a2546823
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5bece995c33d51031c46826c2205c445a2546823
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Jun 20 11:05:56 2021 -0500
ws2_32: Use IOCTL_AFD_WINE_GET_INFO.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index f8ba7025ec5..44c0690d535 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1433,41 +1433,29 @@ static INT WS_DuplicateSocket(BOOL unicode, SOCKET s, DWORD dwProcessId, LPWSAPR
static BOOL ws_protocol_info(SOCKET s, int unicode, WSAPROTOCOL_INFOW *buffer, int *size)
{
+ struct afd_get_info_params params;
+ IO_STATUS_BLOCK io;
NTSTATUS status;
- int address_family;
- int socket_type;
- int protocol;
unsigned int i;
*size = unicode ? sizeof(WSAPROTOCOL_INFOW) : sizeof(WSAPROTOCOL_INFOA);
memset(buffer, 0, *size);
- SERVER_START_REQ( get_socket_info )
- {
- req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
- status = wine_server_call( req );
- if (!status)
- {
- address_family = reply->family;
- socket_type = reply->type;
- protocol = reply->protocol;
- }
- }
- SERVER_END_REQ;
-
+ status = NtDeviceIoControlFile( (HANDLE)s, NULL, NULL, NULL, &io,
+ IOCTL_AFD_WINE_GET_INFO, NULL, 0, ¶ms, sizeof(params) );
if (status)
{
- unsigned int err = NtStatusToWSAError( status );
- SetLastError( err == WSAEBADF ? WSAENOTSOCK : err );
+ SetLastError( NtStatusToWSAError( status ) );
return FALSE;
}
for (i = 0; i < ARRAY_SIZE(supported_protocols); ++i)
{
const WSAPROTOCOL_INFOW *info = &supported_protocols[i];
- if (address_family == info->iAddressFamily &&
- socket_type == info->iSocketType &&
- protocol >= info->iProtocol && protocol <= info->iProtocol + info->iProtocolMaxOffset)
+ if (params.family == info->iAddressFamily &&
+ params.type == info->iSocketType &&
+ params.protocol >= info->iProtocol &&
+ params.protocol <= info->iProtocol + info->iProtocolMaxOffset)
{
if (unicode)
*buffer = *info;
@@ -1478,12 +1466,12 @@ static BOOL ws_protocol_info(SOCKET s, int unicode, WSAPROTOCOL_INFOW *buffer, i
WideCharToMultiByte( CP_ACP, 0, info->szProtocol, -1,
bufferA->szProtocol, sizeof(bufferA->szProtocol), NULL, NULL );
}
- buffer->iProtocol = protocol;
+ buffer->iProtocol = params.protocol;
return TRUE;
}
}
- FIXME("Could not fill protocol information for family %d, type %d, protocol %d.\n",
- address_family, socket_type, protocol);
+ FIXME( "Could not fill protocol information for family %d, type %d, protocol %d.\n",
+ params.family, params.type, params.protocol );
return TRUE;
}
More information about the wine-cvs
mailing list