ReactOS 0.4.15-dev-7953-g1f49173
mxevent.h
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5ModuleName:
6
7 MxEvent.h
8
9Abstract:
10
11 Mode agnostic definition of event
12
13 See MxEventKm.h and MxEventUm.h for mode
14 specific implementations
15
16Author:
17
18
19
20Revision History:
21
22
23
24--*/
25
26#pragma once
27
29{
30
31private:
32 //
33 // MdEvent is typedef'ed to appropriate type for the mode
34 // in the mode specific file
35 //
37
39
40public:
41 __inline
42 MxEvent(
43 );
44
45 __inline
47 );
48
50 __inline
55 );
56
57 //
58 // GetEvent will return the underlying primitive event
59 // PKEVENT in case of kernel mode and event HANDLE in case of user-mode
60 //
61 __inline
62 PVOID
64 );
65
66 __inline
67 VOID
68 Set(
69 );
70
71 __inline
72 VOID
75 );
76
77 __inline
78 VOID
79 Clear(
80 );
81
85 __inline
87 WaitFor(
88 __in KWAIT_REASON WaitReason,
89 __in KPROCESSOR_MODE WaitMode,
92 );
93
94 //
95 // NOTE: In user mode this function can only be called
96 // for a notification event (and not for a
97 // synchronization event)
98 //
99 __inline
100 LONG
101 ReadState(
102 );
103
104 __inline
105 VOID
107 );
108
109 MxEvent*
111 VOID
112 )
113 {
114 //
115 // Since operator& is hidden, we still need to be able to get a pointer
116 // to this object, so we must make it an explicit method.
117 //
118 return this;
119 }
120
121private:
123 VOID
124 )
125 {
126 //
127 // By making the address of operator private, we make it harder
128 // to accidentally use this object in an improper fashion, ie
129 // something like this is prevented:
130 //
131 // MxEvent event;
132 // KeWaitForSingleObject(&event, ...);
133 //
134 // However please note that in some cases event pointer is needed when
135 // event is passed around, in which case, GetSelfPointer() is used and
136 // this protection is circumvented. Calling code should be careful
137 // not to pass the pointer to KeWaitForSingleObject in such cases.
138 //
139 ASSERT(FALSE);
140 return NULL;
141 }
142
143};
unsigned char BOOLEAN
Type
Definition: Type.h:7
LONG NTSTATUS
Definition: precomp.h:26
__drv_when(Timeout==NULL &&Alertable==FALSE, __drv_valueIs(==0)) __drv_when(Timeout !
__inline VOID SetWithIncrement(__in KPRIORITY Priority)
Definition: mxeventkm.h:80
_Must_inspect_result_ __inline NTSTATUS WaitFor(__in KWAIT_REASON WaitReason, __in KPROCESSOR_MODE WaitMode, __in BOOLEAN Alertable, __in_opt PLARGE_INTEGER Timeout)
Definition: mxeventkm.h:115
__inline VOID Clear()
Definition: mxeventkm.h:102
__inline VOID Uninitialize()
Definition: mxeventkm.h:146
__drv_valueIs(==0;==258)) __drv_when(Timeout !
__inline ~MxEvent()
Definition: mxeventkm.h:46
MxEvent * operator&(VOID)
Definition: mxevent.h:122
__inline PVOID GetEvent()
Definition: mxeventkm.h:69
__inline VOID Set()
Definition: mxeventkm.h:91
__inline MxEvent()
Definition: mxeventkm.h:31
MxEvent * GetSelfPointer(VOID)
Definition: mxevent.h:110
__inline LONG ReadState()
Definition: mxeventkm.h:135
MdEvent m_Event
Definition: mxevent.h:36
DECLARE_DBGFLAG_INITIALIZED
Definition: mxevent.h:38
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG KPRIORITY
Definition: compat.h:803
#define __drv_when(cond, annotes)
Definition: driverspecs.h:335
#define ASSERT(a)
Definition: mode.c:44
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define CHECK_RETURN_IF_USER_MODE
Definition: mxmacros.h:26
_In_ PVOID _In_ BOOLEAN Alertable
Definition: exfuncs.h:453
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE _In_ BOOLEAN InitialState
Definition: exfuncs.h:169
enum _EVENT_TYPE EVENT_TYPE
long LONG
Definition: pedump.c:60
static ULONG Timeout
Definition: ping.c:61
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
enum _KWAIT_REASON KWAIT_REASON
static void Initialize()
Definition: xlate.c:212