|
|
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_port.h>
|
|
|
dd89bb |
#include <ntapi/nt_tty.h>
|
|
|
dd89bb |
#include <ntapi/nt_vmount.h>
|
|
|
dd89bb |
#include <ntapi/ntapi.h>
|
|
|
dd89bb |
#include "ntapi_impl.h"
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
static void __vms_port_name_from_server_info(
|
|
|
dd89bb |
__out nt_port_name * vms_port_name,
|
|
|
dd89bb |
__in nt_tty_vms_info * vmsinfo)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
nt_port_attr port_attr;
|
|
|
dd89bb |
|
|
|
dd89bb |
port_attr.type = NT_PORT_TYPE_VMOUNT;
|
|
|
dd89bb |
port_attr.subtype = NT_PORT_SUBTYPE_DEFAULT;
|
|
|
dd89bb |
|
|
|
dd89bb |
__ntapi->tt_aligned_block_memcpy(
|
|
|
dd89bb |
(uintptr_t *)&port_attr.keys,
|
|
|
dd89bb |
(uintptr_t *)&vmsinfo->vms_keys,
|
|
|
dd89bb |
sizeof(nt_port_keys));
|
|
|
dd89bb |
|
|
|
dd89bb |
__ntapi->tt_port_guid_from_type(
|
|
|
dd89bb |
&port_attr.guid,
|
|
|
dd89bb |
port_attr.type,
|
|
|
dd89bb |
port_attr.subtype);
|
|
|
dd89bb |
|
|
|
dd89bb |
__ntapi->tt_port_name_from_attributes(
|
|
|
dd89bb |
vms_port_name,
|
|
|
dd89bb |
&port_attr);
|
|
|
dd89bb |
}
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
int32_t __stdcall __ntapi_vms_client_connect(
|
|
|
dd89bb |
__out void ** hvms,
|
|
|
dd89bb |
__in nt_tty_vms_info * vmsinfo)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
int32_t status;
|
|
|
dd89bb |
nt_port_name vms_port_name;
|
|
|
dd89bb |
|
|
|
dd89bb |
nt_unicode_string name;
|
|
|
dd89bb |
nt_sqos sqos;
|
|
|
dd89bb |
nt_oa oa;
|
|
|
dd89bb |
|
|
|
dd89bb |
/* vmount daemon port name */
|
|
|
dd89bb |
__vms_port_name_from_server_info(
|
|
|
dd89bb |
&vms_port_name,
|
|
|
dd89bb |
vmsinfo);
|
|
|
dd89bb |
|
|
|
dd89bb |
/* port name init */
|
|
|
dd89bb |
name.buffer = (wchar16_t *)&vms_port_name;
|
|
|
dd89bb |
name.maxlen = 0;
|
|
|
dd89bb |
name.strlen = (uint16_t)(size_t)(&((nt_port_name *)0)->null_termination);
|
|
|
dd89bb |
|
|
|
dd89bb |
/* init security structure */
|
|
|
dd89bb |
sqos.length = sizeof(sqos);
|
|
|
dd89bb |
sqos.impersonation_level = NT_SECURITY_IMPERSONATION;
|
|
|
dd89bb |
sqos.context_tracking_mode = NT_SECURITY_TRACKING_DYNAMIC;
|
|
|
dd89bb |
sqos.effective_only = 1;
|
|
|
dd89bb |
|
|
|
dd89bb |
/* init the port's object attributes */
|
|
|
dd89bb |
oa.len = sizeof(oa);
|
|
|
dd89bb |
oa.root_dir = (void *)0;
|
|
|
dd89bb |
oa.obj_name = &nam;;
|
|
|
dd89bb |
oa.obj_attr = 0;
|
|
|
dd89bb |
oa.sec_desc = (nt_security_descriptor *)0;
|
|
|
dd89bb |
oa.sec_qos = &sqo;;
|
|
|
dd89bb |
|
|
|
dd89bb |
status = __ntapi->zw_connect_port(
|
|
|
dd89bb |
hvms,
|
|
|
dd89bb |
&name,
|
|
|
dd89bb |
&sqos,
|
|
|
dd89bb |
(nt_port_section_write *)0,
|
|
|
dd89bb |
(nt_port_section_read *)0,
|
|
|
dd89bb |
(uint32_t *)0,
|
|
|
dd89bb |
(void *)0,
|
|
|
dd89bb |
(uint32_t *)0);
|
|
|
dd89bb |
|
|
|
dd89bb |
return status;
|
|
|
dd89bb |
}
|