|
|
dd89bb |
/********************************************************/
|
|
|
dd89bb |
/* ntapi: Native API core library */
|
|
|
dd89bb |
/* Copyright (C) 2013,2014,2015 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_vmount.h>
|
|
|
dd89bb |
#include <ntapi/ntapi.h>
|
|
|
dd89bb |
#include "ntapi_impl.h"
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
static int32_t __stdcall __ntapi_vms_ref_count_inc_dec(
|
|
|
dd89bb |
__in void * hvms,
|
|
|
dd89bb |
__in nt_vms_ref_count_info * ref_cnt_info,
|
|
|
dd89bb |
__in int32_t vms_opcode)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
int32_t status;
|
|
|
dd89bb |
nt_vms_daemon_msg msg;
|
|
|
dd89bb |
|
|
|
dd89bb |
/* msg */
|
|
|
dd89bb |
__ntapi->tt_aligned_block_memset(&msg,0,sizeof(msg));
|
|
|
dd89bb |
|
|
|
dd89bb |
msg.header.msg_type = NT_LPC_NEW_MESSAGE;
|
|
|
dd89bb |
msg.header.data_size = sizeof(msg.data);
|
|
|
dd89bb |
msg.header.msg_size = sizeof(msg);
|
|
|
dd89bb |
msg.data.msginfo.opcode = vms_opcode;
|
|
|
dd89bb |
|
|
|
dd89bb |
/* copy ref count info to msg */
|
|
|
dd89bb |
__ntapi->tt_aligned_block_memcpy(
|
|
|
dd89bb |
(uintptr_t *)&(msg.data.refcntinfo),
|
|
|
dd89bb |
(uintptr_t *)ref_cnt_info,
|
|
|
dd89bb |
sizeof(*ref_cnt_info));
|
|
|
dd89bb |
|
|
|
dd89bb |
/* zw_request_wait_reply_port */
|
|
|
dd89bb |
status = __ntapi->zw_request_wait_reply_port(
|
|
|
dd89bb |
hvms,
|
|
|
dd89bb |
&msg,
|
|
|
dd89bb |
&msg;;
|
|
|
dd89bb |
|
|
|
dd89bb |
if (status) return status;
|
|
|
dd89bb |
|
|
|
dd89bb |
/* return info */
|
|
|
dd89bb |
__ntapi->tt_aligned_block_memcpy(
|
|
|
dd89bb |
(uintptr_t *)ref_cnt_info,
|
|
|
dd89bb |
(uintptr_t *)&(msg.data.refcntinfo),
|
|
|
dd89bb |
sizeof(*ref_cnt_info));
|
|
|
dd89bb |
|
|
|
dd89bb |
/* return vms status */
|
|
|
dd89bb |
return status ? status : msg.data.msginfo.status;
|
|
|
dd89bb |
}
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
int32_t __stdcall __ntapi_vms_ref_count_inc(
|
|
|
dd89bb |
__in void * hvms,
|
|
|
dd89bb |
__in nt_vms_ref_count_info * ref_cnt_info)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
return __ntapi_vms_ref_count_inc_dec(
|
|
|
dd89bb |
hvms,
|
|
|
dd89bb |
ref_cnt_info,
|
|
|
dd89bb |
NT_VMS_REF_COUNT_INC);
|
|
|
dd89bb |
}
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
int32_t __stdcall __ntapi_vms_ref_count_dec(
|
|
|
dd89bb |
__in void * hvms,
|
|
|
dd89bb |
__in nt_vms_ref_count_info * ref_cnt_info)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
return __ntapi_vms_ref_count_inc_dec(
|
|
|
dd89bb |
hvms,
|
|
|
dd89bb |
ref_cnt_info,
|
|
|
dd89bb |
NT_VMS_REF_COUNT_DEC);
|
|
|
dd89bb |
}
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
int32_t __stdcall __ntapi_vms_point_detach(
|
|
|
dd89bb |
__in void * hvms,
|
|
|
dd89bb |
__in nt_vms_ref_count_info * ref_cnt_info)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
return __ntapi_vms_ref_count_inc_dec(
|
|
|
dd89bb |
hvms,
|
|
|
dd89bb |
ref_cnt_info,
|
|
|
dd89bb |
NT_VMS_POINT_DETACH);
|
|
|
dd89bb |
}
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
int32_t __stdcall __ntapi_vms_point_get_handles(
|
|
|
dd89bb |
__in void * hvms,
|
|
|
dd89bb |
__in nt_vms_ref_count_info * ref_cnt_info)
|
|
|
dd89bb |
{
|
|
|
dd89bb |
return __ntapi_vms_ref_count_inc_dec(
|
|
|
dd89bb |
hvms,
|
|
|
dd89bb |
ref_cnt_info,
|
|
|
dd89bb |
NT_VMS_POINT_GET_HANDLES);
|
|
|
dd89bb |
}
|