From 3260d19ee4f4441805c42a86d636518dacab3567 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 16 Jun 2016 14:48:36 -0400 Subject: ntapi_sc_bind(): properly support afd (port-sharing) flags. --- src/socket/ntapi_sc_bind_v1.c | 10 ++++++---- src/socket/ntapi_sc_bind_v2.c | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/socket/ntapi_sc_bind_v1.c b/src/socket/ntapi_sc_bind_v1.c index bf07a60..df3e84f 100644 --- a/src/socket/ntapi_sc_bind_v1.c +++ b/src/socket/ntapi_sc_bind_v1.c @@ -35,7 +35,8 @@ int32_t __cdecl __ntapi_sc_bind_v1( __in nt_socket * hssocket, __in const nt_sockaddr * addr, __in uintptr_t addrlen, - __in uintptr_t service_flags __optional, + __in uint32_t afdflags __optional, + __in uint32_t srvflags __optional, __out nt_sockaddr * sockaddr __optional, __out nt_io_status_block * iosb __optional) { @@ -46,18 +47,19 @@ int32_t __cdecl __ntapi_sc_bind_v1( _addr_memcpy * src; _addr_memcpy * dst; + (void)afdflags; (void)addrlen; iosb = iosb ? iosb : &siosb; /* service_flags */ - if (!service_flags) - service_flags = 0x2000E; + if (!srvflags) + srvflags = 0x2000E; /* afd_bind_req */ afd_bind_req.domain = hssocket->domain; afd_bind_req.type = hssocket->type; - afd_bind_req.service_flags = (uint32_t)service_flags; + afd_bind_req.service_flags = srvflags; src = (_addr_memcpy *)addr; dst = (_addr_memcpy *)&(afd_bind_req.sa_data); diff --git a/src/socket/ntapi_sc_bind_v2.c b/src/socket/ntapi_sc_bind_v2.c index 7be603f..432e534 100644 --- a/src/socket/ntapi_sc_bind_v2.c +++ b/src/socket/ntapi_sc_bind_v2.c @@ -12,7 +12,7 @@ #include "ntapi_impl.h" typedef struct _nt_afd_bind_request { - uint32_t unknown; + uint32_t flags; nt_sockaddr addr; } nt_afd_bind_request; @@ -32,7 +32,8 @@ int32_t __cdecl __ntapi_sc_bind_v2( __in nt_socket * hssocket, __in const nt_sockaddr * addr, __in uintptr_t addrlen, - __in uintptr_t service_flags __optional, + __in uint32_t afdflags __optional, + __in uint32_t srvflags __optional, __out nt_sockaddr * sockaddr __optional, __out nt_io_status_block * iosb __optional) { @@ -43,7 +44,7 @@ int32_t __cdecl __ntapi_sc_bind_v2( _addr_memcpy * src; _addr_memcpy * dst; - (void)service_flags; + (void)srvflags; if ((addrlen != sizeof(nt_sockaddr_in4)) && (addrlen != sizeof(nt_sockaddr_in6))) @@ -52,7 +53,7 @@ int32_t __cdecl __ntapi_sc_bind_v2( iosb = iosb ? iosb : &siosb; /* request */ - afd_bind_req.unknown = hssocket->domain; + afd_bind_req.flags = afdflags; src = (_addr_memcpy *)addr; dst = (_addr_memcpy *)&(afd_bind_req.addr); -- cgit v1.2.3