Blame src/socket/ntapi_sc_getsockopt.c
|
|
419228 |
/********************************************************/
|
|
|
419228 |
/* ntapi: Native API core library */
|
|
|
419228 |
/* Copyright (C) 2013--2016 Z. Gilboa */
|
|
|
419228 |
/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
|
|
|
419228 |
/********************************************************/
|
|
|
419228 |
|
|
|
419228 |
#include <psxtypes/psxtypes.h>
|
|
|
419228 |
#include <ntapi/nt_object.h>
|
|
|
419228 |
#include <ntapi/nt_file.h>
|
|
|
419228 |
#include <ntapi/nt_socket.h>
|
|
|
419228 |
#include <ntapi/ntapi.h>
|
|
|
419228 |
#include "ntapi_impl.h"
|
|
|
419228 |
|
|
|
419228 |
int32_t __cdecl __ntapi_sc_getsockopt(
|
|
|
419228 |
__in nt_socket * hssocket,
|
|
|
419228 |
__in int32_t level,
|
|
|
419228 |
__in int32_t optname,
|
|
|
419228 |
__out void * optval,
|
|
|
419228 |
__in uint32_t optlen,
|
|
|
419228 |
__out nt_io_status_block * iosb)
|
|
|
419228 |
{
|
|
|
419228 |
nt_afd_sockopt_info afd_sockopt;
|
|
|
419228 |
|
|
|
419228 |
if (!iosb)
|
|
|
419228 |
return NT_STATUS_INVALID_PARAMETER_6;
|
|
|
419228 |
|
|
|
419228 |
/* afd_sockopt */
|
|
|
419228 |
afd_sockopt.mode = NT_AFD_SOCKOPT_GET;
|
|
|
419228 |
afd_sockopt.level = level;
|
|
|
419228 |
afd_sockopt.optname = optname;
|
|
|
419228 |
afd_sockopt.optval = 0;
|
|
|
419228 |
afd_sockopt.optlen = 0;
|
|
|
419228 |
afd_sockopt.ding = 1;
|
|
|
419228 |
|
|
|
419228 |
hssocket->iostatus = __ntapi->zw_device_io_control_file(
|
|
|
419228 |
hssocket->hsocket,
|
|
|
419228 |
hssocket->hevent,
|
|
|
419228 |
0,
|
|
|
419228 |
0,
|
|
|
419228 |
iosb,
|
|
|
419228 |
NT_AFD_IOCTL_SOCKOPT,
|
|
|
419228 |
&afd_sockopt,
|
|
|
419228 |
sizeof(afd_sockopt),
|
|
|
419228 |
optval,
|
|
|
419228 |
optlen);
|
|
|
419228 |
|
|
|
419228 |
return hssocket->iostatus
|
|
|
419228 |
? __ntapi->sc_wait(hssocket,iosb,0)
|
|
|
419228 |
: NT_STATUS_SUCCESS;
|
|
|
419228 |
}
|