summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-18 14:17:49 -0500
committermidipix <writeonce@midipix.org>2016-12-18 21:39:13 -0500
commit49a598735a225c148265fa0b237909b152ba89fe (patch)
tree2ad213c4d99eab1c840a9c3f82172c408ddae6dc
parentb5150521954ed18d1e349f9b0a68d9cc19537932 (diff)
downloadntapi-49a598735a225c148265fa0b237909b152ba89fe.tar.bz2
ntapi-49a598735a225c148265fa0b237909b152ba89fe.tar.xz
__ntapi_sc_socket_V{1|2}: provide smooth foreign compiler support.
-rw-r--r--src/socket/ntapi_sc_socket_v1.c14
-rw-r--r--src/socket/ntapi_sc_socket_v2.c14
2 files changed, 24 insertions, 4 deletions
diff --git a/src/socket/ntapi_sc_socket_v1.c b/src/socket/ntapi_sc_socket_v1.c
index c9b4519..e4752a4 100644
--- a/src/socket/ntapi_sc_socket_v1.c
+++ b/src/socket/ntapi_sc_socket_v1.c
@@ -39,6 +39,8 @@ int32_t __cdecl __ntapi_sc_socket_v1(
nt_sqos ssqos;
nt_unicode_string nt_afdep;
uint32_t ea_length;
+ uint16_t sdomain;
+ uint16_t stype;
void * _hsocket;
wchar16_t afd_end_point[] = {
@@ -47,6 +49,11 @@ int32_t __cdecl __ntapi_sc_socket_v1(
'\\','E','n','d','P','o','i','n','t',
0};
+ if (domain >= 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_2;
+ else if (type > 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_3;
+
/* tcp as default extended attribute */
nt_afd_socket_ea afd_ea = {
0,
@@ -103,11 +110,14 @@ int32_t __cdecl __ntapi_sc_socket_v1(
oa.obj_name = 0;
oa.obj_attr = 0;
+ sdomain = (uint16_t)domain;
+ stype = (uint16_t)type;
+
if (status == NT_STATUS_SUCCESS) {
hssocket->hsocket = _hsocket;
hssocket->ntflags = 0;
- hssocket->domain = domain;
- hssocket->type = type;
+ hssocket->domain = sdomain;
+ hssocket->type = stype;
hssocket->protocol = protocol;
hssocket->timeout.quad = 0;
hssocket->iostatus = NT_STATUS_SUCCESS;
diff --git a/src/socket/ntapi_sc_socket_v2.c b/src/socket/ntapi_sc_socket_v2.c
index 2fc30e5..5b1493c 100644
--- a/src/socket/ntapi_sc_socket_v2.c
+++ b/src/socket/ntapi_sc_socket_v2.c
@@ -44,6 +44,8 @@ int32_t __cdecl __ntapi_sc_socket_v2(
nt_sqos ssqos;
nt_unicode_string nt_afdep;
uint32_t ea_length;
+ uint16_t sdomain;
+ uint16_t stype;
void * _hsocket;
wchar16_t afd_end_point[] = {
@@ -61,6 +63,11 @@ int32_t __cdecl __ntapi_sc_socket_v2(
{0,0,0,0,0},
{0}};
+ if (domain >= 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_2;
+ else if (type > 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_3;
+
ea_length = sizeof(afd_ea);
afd_ea.sattr.domain = domain;
@@ -111,10 +118,13 @@ int32_t __cdecl __ntapi_sc_socket_v2(
oa.obj_name = 0;
oa.obj_attr = 0;
+ sdomain = (uint16_t)domain;
+ stype = (uint16_t)type;
+
hssocket->hsocket = _hsocket;
hssocket->ntflags = 0;
- hssocket->domain = domain;
- hssocket->type = type;
+ hssocket->domain = sdomain;
+ hssocket->type = stype;
hssocket->protocol = protocol;
hssocket->timeout.quad = 0;
hssocket->iostatus = NT_STATUS_SUCCESS;