1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/********************************************************/
/* ntapi: Native API core library */
/* Copyright (C) 2013--2017 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
/********************************************************/
#include <psxtypes/psxtypes.h>
#include <ntapi/nt_object.h>
#include <ntapi/nt_sync.h>
#include <ntapi/ntapi.h>
#include "ntapi_impl.h"
static int32_t __cdecl __tt_create_event(
__out void * volatile * 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 * volatile * hevent,
__in nt_event_type event_type,
__in int32_t initial_state)
{
return __tt_create_event(
hevent,
event_type,
initial_state,
0);
}
|