Blame src/socket/ntapi_sc_getpeername_v2.c
|
|
5d8625 |
/********************************************************/
|
|
|
5d8625 |
/* ntapi: Native API core library */
|
|
|
64e606 |
/* Copyright (C) 2013--2021 SysDeer Technologies, LLC */
|
|
|
5d8625 |
/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
|
|
|
5d8625 |
/********************************************************/
|
|
|
5d8625 |
|
|
|
5d8625 |
#include <psxtypes/psxtypes.h>
|
|
|
5d8625 |
#include <ntapi/nt_object.h>
|
|
|
5d8625 |
#include <ntapi/nt_file.h>
|
|
|
5d8625 |
#include <ntapi/nt_socket.h>
|
|
|
5d8625 |
#include <ntapi/ntapi.h>
|
|
|
5d8625 |
#include "ntapi_impl.h"
|
|
|
5d8625 |
|
|
|
5d8625 |
int32_t __cdecl __ntapi_sc_getpeername_v2(
|
|
|
5d8625 |
__in nt_socket * hssocket,
|
|
|
5d8625 |
__in nt_sockaddr * addr,
|
|
|
5d8625 |
__in uint16_t * addrlen,
|
|
|
2e04e9 |
__out nt_iosb volatile * iosb __optional)
|
|
|
5d8625 |
{
|
|
|
2e04e9 |
nt_iosb volatile siosb;
|
|
|
5d8625 |
|
|
|
5d8625 |
iosb = iosb ? iosb : &siosb;
|
|
|
5d8625 |
|
|
|
5d8625 |
hssocket->iostatus = __ntapi->zw_device_io_control_file(
|
|
|
5d8625 |
hssocket->hsocket,
|
|
|
5d8625 |
hssocket->hevent,
|
|
|
5d8625 |
0,
|
|
|
5d8625 |
0,
|
|
|
5d8625 |
iosb,
|
|
|
5d8625 |
NT_AFD_IOCTL_GET_PEER_NAME,
|
|
|
5d8625 |
0,
|
|
|
5d8625 |
0,
|
|
|
5d8625 |
addr,
|
|
|
5d8625 |
sizeof(*addr));
|
|
|
5d8625 |
|
|
|
5d8625 |
__ntapi->sc_wait(hssocket,iosb,0);
|
|
|
5d8625 |
|
|
|
5d8625 |
if (!hssocket->iostatus)
|
|
|
5d8625 |
*addrlen = (uint16_t)iosb->info;
|
|
|
5d8625 |
|
|
|
5d8625 |
return hssocket->iostatus;
|
|
|
5d8625 |
}
|