ReactOS  0.4.15-dev-1201-gb2cf5a4
IoEvent.c File Reference
#include <kmt_test.h>
Include dependency graph for IoEvent.c:

Go to the source code of this file.

Macros

#define KERNEL_HANDLE_FLAG   0x80000000
 
#define CheckEventObject(Handle, Pointers, Handles)
 

Functions

static VOID TestCreateEvent (PRKEVENT(NTAPI *CreateEvent)(PUNICODE_STRING, PHANDLE), PUNICODE_STRING EventName, EVENT_TYPE Type)
 
 START_TEST (IoEvent)
 

Macro Definition Documentation

◆ CheckEventObject

#define CheckEventObject (   Handle,
  Pointers,
  Handles 
)
Value:
do \
{ \
PUBLIC_OBJECT_BASIC_INFORMATION ObjectInfo; \
Status = ZwQueryObject(Handle, ObjectBasicInformation, \
&ObjectInfo, sizeof ObjectInfo, NULL); \
ok_eq_hex(Status, STATUS_SUCCESS); \
ok_eq_ulong(ObjectInfo.PointerCount, Pointers); \
ok_eq_ulong(ObjectInfo.HandleCount, Handles); \
ok_eq_ulong(ObjectInfo.Attributes, 0); \
ok_eq_ulong(ObjectInfo.GrantedAccess, EVENT_ALL_ACCESS); \
"Handle %p is not a kernel handle\n", Handle); \
} while (0)
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE Handle
Definition: extypes.h:390
Status
Definition: gdiplustypes.h:24
#define KERNEL_HANDLE_FLAG
Definition: IoEvent.c:13
return STATUS_SUCCESS
Definition: btrfs.c:3014

Definition at line 16 of file IoEvent.c.

◆ KERNEL_HANDLE_FLAG

#define KERNEL_HANDLE_FLAG   0x80000000

Definition at line 13 of file IoEvent.c.

Function Documentation

◆ START_TEST()

START_TEST ( IoEvent  )

Definition at line 88 of file IoEvent.c.

89 {
90  PKEVENT Event, Event2;
91  HANDLE EventHandle = NULL, EventHandle2 = NULL;
92  UNICODE_STRING NotificationEventName = RTL_CONSTANT_STRING(L"\\BaseNamedObjects\\KmTestIoEventNotificationEvent");
93  UNICODE_STRING SynchronizationEventName = RTL_CONSTANT_STRING(L"\\BaseNamedObjects\\KmTestIoEventSynchronizationEvent");
94 
97 
98  /* Create different types with the same name */
99  Event = IoCreateNotificationEvent(&NotificationEventName, &EventHandle);
100  ok(Event != NULL, "Event is NULL\n");
101  ok(EventHandle != NULL, "EventHandle is NULL\n");
102  if (!skip(EventHandle != NULL, "No event\n"))
103  {
104  ok_eq_uint(Event->Header.Type, NotificationEvent);
105  Event2 = IoCreateSynchronizationEvent(&NotificationEventName, &EventHandle2);
106  ok(Event2 != NULL, "Event is NULL\n");
107  ok(EventHandle2 != NULL, "EventHandle is NULL\n");
108  if (!skip(EventHandle2 != NULL, "No event\n"))
109  {
111  ZwClose(EventHandle2);
112  }
114  }
115 
116 }
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
static VOID TestCreateEvent(PRKEVENT(NTAPI *CreateEvent)(PUNICODE_STRING, PHANDLE), PUNICODE_STRING EventName, EVENT_TYPE Type)
Definition: IoEvent.c:32
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
smooth NULL
Definition: ftsmooth.c:416
PKEVENT NTAPI IoCreateNotificationEvent(IN PUNICODE_STRING EventName, IN PHANDLE EventHandle)
Definition: ioevent.c:70
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
DISPATCHER_HEADER Header
Definition: ketypes.h:800
PKEVENT NTAPI IoCreateSynchronizationEvent(IN PUNICODE_STRING EventName, IN PHANDLE EventHandle)
Definition: ioevent.c:82
#define skip(...)
Definition: atltest.h:64
#define ok_eq_uint(value, expected)
Definition: kmt_test.h:239
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

◆ TestCreateEvent()

static VOID TestCreateEvent ( PRKEVENT(NTAPI *CreateEvent)(PUNICODE_STRING, PHANDLE ,
PUNICODE_STRING  EventName,
EVENT_TYPE  Type 
)
static

Definition at line 32 of file IoEvent.c.

36 {
38  PKEVENT Event, Event2;
39  HANDLE EventHandle, EventHandle2;
40  LONG State;
41 
42  /* Nameless event */
43  KmtStartSeh()
45  ok(Event != NULL, "Event is NULL\n");
46  ok(EventHandle != NULL, "EventHandle is NULL\n");
47  if (!skip(EventHandle != NULL, "No event\n"))
48  {
49  ok_eq_uint(Event->Header.Type, Type);
51  ok_eq_long(State, 1L);
55  }
57 
58  /* Named event */
59  EventHandle = NULL;
60  Event = CreateEvent(EventName, &EventHandle);
61  ok(Event != NULL, "Event is NULL\n");
62  ok(EventHandle != NULL, "EventHandle is NULL\n");
63  if (!skip(EventHandle != NULL, "No event\n"))
64  {
65  ok_eq_uint(Event->Header.Type, Type);
67  ok_eq_long(State, 1L);
69 
70  /* Open the existing one */
71  EventHandle2 = NULL;
72  Event2 = CreateEvent(EventName, &EventHandle2);
74  ok(Event2 != NULL, "Event is NULL\n");
75  ok(EventHandle2 != NULL, "EventHandle is NULL\n");
76  if (!skip(EventHandle2 != NULL, "No event\n"))
77  {
78  CheckEventObject(EventHandle2, 4UL, 2UL);
79  ZwClose(EventHandle2);
80  }
81 
85  }
86 }
#define CreateEvent
Definition: winbase.h:3588
Type
Definition: Type.h:6
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
#define CheckEventObject(Handle, Pointers, Handles)
Definition: IoEvent.c:16
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:283
GLdouble n
Definition: glext.h:7729
_In_ ULONG _In_ ULONG State
Definition: potypes.h:516
long LONG
Definition: pedump.c:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
struct _cl_event * event
Definition: glext.h:7739
#define KmtStartSeh()
Definition: kmt_test.h:277
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
LONG NTAPI KeReadStateEvent(IN PKEVENT Event)
Definition: eventobj.c:120
#define ok_eq_hex(value, expected)
#define ok_eq_uint(value, expected)
Definition: kmt_test.h:239
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define UL
Definition: tui.h:82
#define ok_eq_long(value, expected)
Definition: kmt_test.h:240
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by START_TEST().