|
|
dd89bb |
/********************************************************/
|
|
|
dd89bb |
/* ntapi: Native API core library */
|
|
|
4256e2 |
/* Copyright (C) 2013--2016 Z. Gilboa */
|
|
|
dd89bb |
/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
|
|
|
dd89bb |
/********************************************************/
|
|
|
dd89bb |
|
|
|
dd89bb |
#include <psxtypes/psxtypes.h>
|
|
|
dd89bb |
#include <ntapi/nt_object.h>
|
|
|
dd89bb |
#include <ntapi/nt_file.h>
|
|
|
dd89bb |
#include <ntapi/nt_socket.h>
|
|
|
dd89bb |
#include <ntapi/ntapi.h>
|
|
|
dd89bb |
#include "ntapi_impl.h"
|
|
|
dd89bb |
|
|
|
dd89bb |
int32_t __cdecl __ntapi_sc_server_duplicate_socket(
|
|
|
dd89bb |
__in nt_socket * hssock_listen,
|
|
|
dd89bb |
__in nt_socket * hssock_dedicated,
|
|
|
dd89bb |
__in nt_afd_accept_info * accept_info,
|
|
|
dd89bb |
__out nt_io_status_block * iosb __optional)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
nt_afd_duplicate_info duplicate_info;
|
|
|
dd89bb |
nt_io_status_block siosb;
|
|
|
dd89bb |
|
|
|
dd89bb |
iosb = iosb ? iosb : &siosb;
|
|
|
dd89bb |
|
|
|
dd89bb |
/* duplicate_info */
|
|
|
dd89bb |
duplicate_info.unknown = 0;
|
|
|
dd89bb |
duplicate_info.sequence = accept_info->sequence;
|
|
|
dd89bb |
duplicate_info.hsocket_dedicated = hssock_dedicated->hsocket;
|
|
|
dd89bb |
|
|
|
dd89bb |
hssock_dedicated->iostatus = __ntapi->zw_device_io_control_file(
|
|
|
dd89bb |
hssock_listen->hsocket,
|
|
|
dd89bb |
hssock_dedicated->hevent,
|
|
|
dd89bb |
0,
|
|
|
dd89bb |
0,
|
|
|
dd89bb |
iosb,
|
|
|
dd89bb |
NT_AFD_IOCTL_DUPLICATE,
|
|
|
dd89bb |
&duplicate_info,
|
|
|
dd89bb |
sizeof(duplicate_info),
|
|
|
dd89bb |
0,
|
|
|
dd89bb |
0);
|
|
|
dd89bb |
|
|
|
dd89bb |
return hssock_dedicated->iostatus
|
|
|
dd89bb |
? __ntapi->sc_wait(hssock_dedicated,iosb,0)
|
|
|
dd89bb |
: NT_STATUS_SUCCESS;
|
|
|
dd89bb |
}
|