summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-16 14:48:36 -0400
committermidipix <writeonce@midipix.org>2016-06-16 14:48:36 -0400
commit3260d19ee4f4441805c42a86d636518dacab3567 (patch)
tree0f7bc5da62ac786ded166367b37a2633a7ba5180
parent4192289efd809a11ae1d29a1e31a0b55930ace8b (diff)
downloadntapi-3260d19ee4f4441805c42a86d636518dacab3567.tar.bz2
ntapi-3260d19ee4f4441805c42a86d636518dacab3567.tar.xz
ntapi_sc_bind(): properly support afd (port-sharing) flags.
-rw-r--r--include/ntapi/nt_socket.h3
-rw-r--r--src/socket/ntapi_sc_bind_v1.c10
-rw-r--r--src/socket/ntapi_sc_bind_v2.c9
3 files changed, 13 insertions, 9 deletions
diff --git a/include/ntapi/nt_socket.h b/include/ntapi/nt_socket.h
index d56f370..68a26b1 100644
--- a/include/ntapi/nt_socket.h
+++ b/include/ntapi/nt_socket.h
@@ -426,7 +426,8 @@ typedef int32_t __cdecl ntapi_sc_bind(
__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);
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);