BazisLib::DDK::KEvent Class Reference

Represents the kernel KEVENT object. More...

#include <ksync.h>

List of all members.

Public Member Functions

 KEvent (EVENT_TYPE Type, bool State)
 ~KEvent ()
bool Valid ()
bool Set (KPRIORITY Increment=IO_NO_INCREMENT, bool NextCallIsWaitXXX=false)
void Clear ()
bool IsSet ()
NTSTATUS Wait (KWAIT_REASON WaitReason=Executive, KPROCESSOR_MODE WaitMode=KernelMode, bool Alertable=false)
NTSTATUS WaitWithTimeout (LONGLONG Timeout, KWAIT_REASON WaitReason=Executive, KPROCESSOR_MODE WaitMode=KernelMode, bool Alertable=false)
 operator PKEVENT ()

Private Attributes

KEVENT * m_pEvent


Detailed Description

Represents the kernel KEVENT object.

Constructor & Destructor Documentation

BazisLib::DDK::KEvent::KEvent ( EVENT_TYPE  Type,
bool  State 
) [inline]

Initializes the KEvent object. The arguments are similar to KeInitializeEvent() routine.

Parameters:
Type Specifies event type. Can be NotificationEvent or SynchronizationEvent. SynchronizationEvent is automatically reset after successful wait, NotificationEvent is not.
State Specifies initial event state.
Remarks:
The real KEVENT object is always allocated from non-paged memory, so the KEvent object can be safely allocated in stack.

Always check whether the event initialization completed using Valid() method before using it. The event initialization may fail if the system is out of non-paged memory.

BazisLib::DDK::KEvent::~KEvent (  )  [inline]


Member Function Documentation

void BazisLib::DDK::KEvent::Clear (  )  [inline]

Here is the call graph for this function:

bool BazisLib::DDK::KEvent::IsSet (  )  [inline]

Here is the call graph for this function:

BazisLib::DDK::KEvent::operator PKEVENT (  )  [inline]

Allows converting KEvent class to KEVENT kernel structure. Can be passed to various routines such as IoBuildSynchronousFsdRequest().

Remarks:
Note that the KEVENT structure will automatically be deleted together with the KEvent object. That way, avoid situations when the KEVENT structure will be accessed after KEvent object deletion. Note that the code patterns like the following are bad:
	NTSTATUS StartXXX()
	{
		KEvent evt;
		StartOperation((PKEVENT)evt, ...);
		return STATUS_PENDING;					//BAD!!! The evt object will be deleted now!
    }
						 
In this example, the operation started by StartOperation() routine may end AFTER the evt is deleted, and its call to KeSetEvent() will cause the system to crash.

Here is the call graph for this function:

bool BazisLib::DDK::KEvent::Set ( KPRIORITY  Increment = IO_NO_INCREMENT,
bool  NextCallIsWaitXXX = false 
) [inline]

Here is the call graph for this function:

bool BazisLib::DDK::KEvent::Valid (  )  [inline]

NTSTATUS BazisLib::DDK::KEvent::Wait ( KWAIT_REASON  WaitReason = Executive,
KPROCESSOR_MODE  WaitMode = KernelMode,
bool  Alertable = false 
) [inline]

Waits for the event to become signalled. The wait operation is not time-limited and will not end by timeout.

Here is the call graph for this function:

NTSTATUS BazisLib::DDK::KEvent::WaitWithTimeout ( LONGLONG  Timeout,
KWAIT_REASON  WaitReason = Executive,
KPROCESSOR_MODE  WaitMode = KernelMode,
bool  Alertable = false 
) [inline]

Waits for the event to become signalled. The wait operation is always time-limited.

Parameters:
Timeout Specifies the wait timeout in 100-nanosecond units. If this parameter has the value of 0, the method returns immediately.

Here is the call graph for this function:


Member Data Documentation


The documentation for this class was generated from the following file:
SourceForge.net Logo