From dd89bb8ad4fe184a34b5dbdda237e640fc82121b Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 27 Jul 2015 04:01:18 -0400 Subject: entered advanced internal development stage. --- src/sync/ntapi_tt_create_event.c | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/sync/ntapi_tt_create_event.c (limited to 'src/sync/ntapi_tt_create_event.c') diff --git a/src/sync/ntapi_tt_create_event.c b/src/sync/ntapi_tt_create_event.c new file mode 100644 index 0000000..3d81938 --- /dev/null +++ b/src/sync/ntapi_tt_create_event.c @@ -0,0 +1,76 @@ +/********************************************************/ +/* ntapi: Native API core library */ +/* Copyright (C) 2013,2014,2015 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */ +/********************************************************/ + +#include +#include +#include +#include +#include "ntapi_impl.h" + + +static int32_t __cdecl __tt_create_event( + __out void ** hevent, + __in nt_event_type event_type, + __in int32_t initial_state, + __in uint32_t obj_attr) +{ + int32_t status; + nt_sqos sqos; + nt_oa oa; + + /* validation */ + if (!hevent) + return NT_STATUS_INVALID_PARAMETER; + + /* security structure */ + sqos.length = sizeof(sqos); + sqos.impersonation_level = NT_SECURITY_IMPERSONATION; + sqos.context_tracking_mode = NT_SECURITY_TRACKING_DYNAMIC; + sqos.effective_only = 1; + + /* object attributes */ + oa.len = sizeof(nt_object_attributes); + oa.root_dir = (void *)0; + oa.obj_name = (nt_unicode_string *)0; + oa.obj_attr = obj_attr; + oa.sec_desc = (nt_security_descriptor *)0; + oa.sec_qos = &sqos; + + status = __ntapi->zw_create_event( + hevent, + NT_EVENT_ALL_ACCESS, + &oa, + event_type, + initial_state); + + return status; +} + + +int32_t __stdcall __ntapi_tt_create_inheritable_event( + __out void ** hevent, + __in nt_event_type event_type, + __in int32_t initial_state) +{ + return __tt_create_event( + hevent, + event_type, + initial_state, + NT_OBJ_INHERIT); +} + + +int32_t __stdcall __ntapi_tt_create_private_event( + __out void ** hevent, + __in nt_event_type event_type, + __in int32_t initial_state) +{ + return __tt_create_event( + hevent, + event_type, + initial_state, + 0); +} -- cgit v1.2.3