BazisLib::DDK::IncomingIrp Class Reference

PowerIRP-aware class that encapsulates an IRP. No extra action is required to process IRP_MJ_POWER requests. More...

#include <irp.h>

List of all members.

Public Types

enum  {
  LowerDriverCalled = 0x01, IrpCompleted = 0x02, IrpMarkedPending = 0x04, IoStatusSet = 0x08,
  IsPowerIrp = 0x10, StartNextPowerIrp = 0x20, FromDispatchThread = 0x40, ValidFlags = 0x7F
}

Public Member Functions

bool IsFromQueue ()
PIO_STATUS_BLOCK GetIoStatus ()
void * GetSystemBuffer ()
PMDL GetMdlAddress ()
void * GetUserBuffer ()
NTSTATUS GetStatus ()
void SetIoStatus (NTSTATUS Status, unsigned Information)
void SetIoStatus (NTSTATUS Status)
void CompleteRequest (CCHAR PriorityBoost=IO_NO_INCREMENT)
void MarkPending ()

Private Member Functions

 IncomingIrp (IRP *pIrp, bool bIsPowerIrp, bool bStartNextPowerIrp)
 IncomingIrp (IRP *pIrp, long Flags)
 ~IncomingIrp ()

Private Attributes

IRP * m_pIrp
long m_Flags

Friends

class Device


Detailed Description

PowerIRP-aware class that encapsulates an IRP. No extra action is required to process IRP_MJ_POWER requests.

A typical driver uses at least 4 different strategies for processing IRPs. We'll overview them here:

The first three strategies can be simply implemented using OO approach: an overridable handler (able to call handlers of inherited classes) processes the IRP (performs synchronous lower driver calls if required), and decides what to do after the handling routine completes: to complete the IRP, or to pass it to the next driver.

The fourth strategy can also be simply implemented using IrpQueue class. See "Queueing IRPs" section below.

The IncomingIRP class allows to implement such strategies smoothly:

Please avoid using thr m_pIrp field directly, because it may make the m_Flags field outdated. Consider adding inline methods instead. Do not forget to set the LowerDriverCalled flag if the lower driver gets called using IoCallDriver() call.

The layout of the IncomingIRP class produces minimal overhead (4 extra DWORDs are allocated in stack per each IRP) and allows maintaining code readability.

Queueing IRPs

The BazisLib::DDK framework provides a smooth way for managing IRP queues. You should take 3 simple steps to convert a synchronous driver to queue-based one:


Member Enumeration Documentation

anonymous enum

Enumerator:
LowerDriverCalled 
IrpCompleted 
IrpMarkedPending 
IoStatusSet 
IsPowerIrp 
StartNextPowerIrp 
FromDispatchThread 
ValidFlags 


Constructor & Destructor Documentation

BazisLib::DDK::IncomingIrp::IncomingIrp ( IRP *  pIrp,
bool  bIsPowerIrp,
bool  bStartNextPowerIrp 
) [inline, private]

BazisLib::DDK::IncomingIrp::IncomingIrp ( IRP *  pIrp,
long  Flags 
) [inline, private]

BazisLib::DDK::IncomingIrp::~IncomingIrp (  )  [inline, private]


Member Function Documentation

void BazisLib::DDK::IncomingIrp::CompleteRequest ( CCHAR  PriorityBoost = IO_NO_INCREMENT  )  [inline]

PIO_STATUS_BLOCK BazisLib::DDK::IncomingIrp::GetIoStatus (  )  [inline]

PMDL BazisLib::DDK::IncomingIrp::GetMdlAddress (  )  [inline]

NTSTATUS BazisLib::DDK::IncomingIrp::GetStatus (  )  [inline]

void* BazisLib::DDK::IncomingIrp::GetSystemBuffer (  )  [inline]

void* BazisLib::DDK::IncomingIrp::GetUserBuffer (  )  [inline]

bool BazisLib::DDK::IncomingIrp::IsFromQueue (  )  [inline]

void BazisLib::DDK::IncomingIrp::MarkPending (  )  [inline]

void BazisLib::DDK::IncomingIrp::SetIoStatus ( NTSTATUS  Status  )  [inline]

void BazisLib::DDK::IncomingIrp::SetIoStatus ( NTSTATUS  Status,
unsigned  Information 
) [inline]


Friends And Related Function Documentation

friend class Device [friend]


Member Data Documentation


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