From dd89bb8ad4fe184a34b5dbdda237e640fc82121b Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 27 Jul 2015 04:01:18 -0400 Subject: entered advanced internal development stage. --- src/socket/ntapi_sc_listen.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/socket/ntapi_sc_listen.c (limited to 'src/socket/ntapi_sc_listen.c') diff --git a/src/socket/ntapi_sc_listen.c b/src/socket/ntapi_sc_listen.c new file mode 100644 index 0000000..cc3e66a --- /dev/null +++ b/src/socket/ntapi_sc_listen.c @@ -0,0 +1,44 @@ +/********************************************************/ +/* ntapi: Native API core library */ +/* Copyright (C) 2013,2014,2015 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */ +/********************************************************/ + +#include +#include +#include +#include +#include +#include "ntapi_impl.h" + +int32_t __cdecl __ntapi_sc_listen( + __in nt_socket * hssocket, + __in uintptr_t backlog, + __out nt_io_status_block * iosb __optional) +{ + nt_afd_listen_info afd_listen; + nt_io_status_block siosb; + + iosb = iosb ? iosb : &siosb; + + /* afd_listen */ + afd_listen.unknown_1st = 0; + afd_listen.unknown_2nd = 0; + afd_listen.backlog = (uint32_t)backlog; + + hssocket->iostatus = __ntapi->zw_device_io_control_file( + hssocket->hsocket, + hssocket->hevent, + 0, + 0, + iosb, + NT_AFD_IOCTL_LISTEN, + &afd_listen, + sizeof(afd_listen), + 0, + 0); + + return hssocket->iostatus + ? __ntapi->sc_wait(hssocket,iosb,0) + : NT_STATUS_SUCCESS; +} -- cgit v1.2.3