From 6a47931d980b8a417f769545eea1bda7b51afea9 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 5 May 2018 00:29:32 +0000 Subject: advisory file locking: integrated client-side interfaces. --- src/afl/ntapi_afl_set.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/afl/ntapi_afl_set.c (limited to 'src/afl/ntapi_afl_set.c') diff --git a/src/afl/ntapi_afl_set.c b/src/afl/ntapi_afl_set.c new file mode 100644 index 0000000..c3aecc4 --- /dev/null +++ b/src/afl/ntapi_afl_set.c @@ -0,0 +1,64 @@ +/********************************************************/ +/* ntapi: Native API core library */ +/* Copyright (C) 2013--2017 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */ +/********************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ntapi_impl.h" + +int32_t __stdcall __ntapi_afl_set( + __in nt_afl_info * afl, + __out nt_io_status_block * iosb, + __in void * afl_info, + __in uint32_t afl_info_length, + __in int32_t afl_info_class) +{ + int32_t status; + nt_afl_info_msg msg; + + /* validate */ + if (!iosb) + return NT_STATUS_INVALID_PARAMETER; + + else if (!afl_info) + return NT_STATUS_INVALID_PARAMETER; + + else if (afl_info_length != sizeof(msg.data.aflinfo)) + return NT_STATUS_INFO_LENGTH_MISMATCH; + + else if (afl_info_class) + return NT_STATUS_INVALID_INFO_CLASS; + + /* msg */ + __ntapi->tt_aligned_block_memset( + &msg,0,sizeof(msg)); + + msg.header.msg_type = NT_LPC_NEW_MESSAGE; + msg.header.data_size = sizeof(msg.data); + msg.header.msg_size = sizeof(msg); + msg.data.ttyinfo.opcode = NT_TTY_AFL_SET; + + __ntapi->tt_generic_memcpy( + &msg.data.aflinfo, + afl_info, + sizeof(msg.data.aflinfo)); + + if ((status = __ntapi->zw_request_wait_reply_port(afl->hport,&msg,&msg))) + return status; + else if (msg.data.ttyinfo.status) + return msg.data.ttyinfo.status; + + /* reply */ + iosb->status = NT_STATUS_SUCCESS; + iosb->info = 0; + + return NT_STATUS_SUCCESS; +} -- cgit v1.2.3