Blame src/sync/ntapi_tt_create_event.c

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_sync.h>
dd89bb
#include <ntapi/ntapi.h>
dd89bb
#include "ntapi_impl.h"
dd89bb
dd89bb
dd89bb
static int32_t __cdecl __tt_create_event(
dd89bb
	__out	void **		hevent,
dd89bb
	__in 	nt_event_type	event_type,
dd89bb
	__in 	int32_t		initial_state,
dd89bb
	__in	uint32_t	obj_attr)
dd89bb
{
dd89bb
	int32_t	status;
dd89bb
	nt_sqos	sqos;
dd89bb
	nt_oa	oa;
dd89bb
dd89bb
	/* validation */
dd89bb
	if (!hevent)
dd89bb
		return NT_STATUS_INVALID_PARAMETER;
dd89bb
dd89bb
	/* 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
	/* object attributes */
dd89bb
	oa.len		= sizeof(nt_object_attributes);
dd89bb
	oa.root_dir	= (void *)0;
dd89bb
	oa.obj_name	= (nt_unicode_string *)0;
dd89bb
	oa.obj_attr	= obj_attr;
dd89bb
	oa.sec_desc	= (nt_security_descriptor *)0;
dd89bb
	oa.sec_qos	= &sqo;;
dd89bb
dd89bb
	status = __ntapi->zw_create_event(
dd89bb
		hevent,
dd89bb
		NT_EVENT_ALL_ACCESS,
dd89bb
		&oa,
dd89bb
		event_type,
dd89bb
		initial_state);
dd89bb
dd89bb
	return status;
dd89bb
}
dd89bb
dd89bb
dd89bb
int32_t __stdcall __ntapi_tt_create_inheritable_event(
dd89bb
	__out	void **		hevent,
dd89bb
	__in 	nt_event_type	event_type,
dd89bb
	__in 	int32_t		initial_state)
dd89bb
{
dd89bb
	return __tt_create_event(
dd89bb
		hevent,
dd89bb
		event_type,
dd89bb
		initial_state,
dd89bb
		NT_OBJ_INHERIT);
dd89bb
}
dd89bb
dd89bb
dd89bb
int32_t __stdcall __ntapi_tt_create_private_event(
dd89bb
	__out	void **		hevent,
dd89bb
	__in 	nt_event_type	event_type,
dd89bb
	__in 	int32_t		initial_state)
dd89bb
{
dd89bb
	return __tt_create_event(
dd89bb
		hevent,
dd89bb
		event_type,
dd89bb
		initial_state,
dd89bb
		0);
dd89bb
}