BazisLib::DDK::IODevice Class Reference

#include <iodevice.h>

Inherits BazisLib::DDK::PNPDevice.

Inherited by BazisLib::DDK::BusDevice, and BazisLib::DDK::StorageDevice [protected].

Collaboration diagram for BazisLib::DDK::IODevice:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 IODevice (DEVICE_TYPE DeviceType=FILE_DEVICE_UNKNOWN, bool bDeleteThisAfterRemoveRequest=false, ULONG DeviceCharacteristics=FILE_DEVICE_SECURE_OPEN, bool bExclusive=FALSE, ULONG AdditionalDeviceFlags=DO_POWER_PAGABLE, LPCWSTR pwszDeviceName=NULL)
virtual ~IODevice ()

Protected Member Functions

virtual NTSTATUS DispatchRoutine (IN IncomingIrp *Irp, IO_STACK_LOCATION *IrpSp) override
virtual NTSTATUS DispatchCleanup (IN IncomingIrp *Irp, IO_STACK_LOCATION *IrpSp)
virtual NTSTATUS OnCreate (PIO_SECURITY_CONTEXT SecurityContext, ULONG Options, USHORT FileAttributes, USHORT ShareAccess, PFILE_OBJECT pFileObj)
virtual NTSTATUS OnClose ()
virtual NTSTATUS OnRead (void *pBuffer, ULONG Length, ULONG Key, ULONGLONG ByteOffset, PULONG pBytesDone)
virtual NTSTATUS OnRead (PMDL pMdl, ULONG Length, ULONG Key, ULONGLONG ByteOffset, PULONG pBytesDone)
virtual NTSTATUS OnWrite (const void *pBuffer, ULONG Length, ULONG Key, ULONGLONG ByteOffset, PULONG pBytesDone)
virtual NTSTATUS OnWrite (PMDL pMdl, ULONG Length, ULONG Key, ULONGLONG ByteOffset, PULONG pBytesDone)
virtual NTSTATUS OnDeviceControl (ULONG ControlCode, bool IsInternal, void *pInOutBuffer, ULONG InputLength, ULONG OutputLength, PULONG pBytesDone)
virtual NTSTATUS OnDeviceControl (ULONG ControlCode, bool IsInternal, void *pInBuffer, PMDL InOutBuffer, ULONG InputLength, ULONG OutputLength, PULONG pBytesDone)
virtual NTSTATUS OnDeviceControl (ULONG ControlCode, bool IsInternal, void *pUserInputBuffer, void *pUserOutputBuffer, ULONG InputLength, ULONG OutputLength, PULONG pBytesDone)


Constructor & Destructor Documentation

BazisLib::DDK::IODevice::IODevice ( DEVICE_TYPE  DeviceType = FILE_DEVICE_UNKNOWN,
bool  bDeleteThisAfterRemoveRequest = false,
ULONG  DeviceCharacteristics = FILE_DEVICE_SECURE_OPEN,
bool  bExclusive = FALSE,
ULONG  AdditionalDeviceFlags = DO_POWER_PAGABLE,
LPCWSTR  pwszDeviceName = NULL 
)

virtual BazisLib::DDK::IODevice::~IODevice (  )  [virtual]


Member Function Documentation

virtual NTSTATUS BazisLib::DDK::IODevice::DispatchCleanup ( IN IncomingIrp Irp,
IO_STACK_LOCATION *  IrpSp 
) [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::IODevice::DispatchRoutine ( IN IncomingIrp Irp,
IO_STACK_LOCATION *  IrpSp 
) [override, protected, virtual]

This method is called every time a device receives an IRP. It Device class it handles the following codes by calling the corresponding virtual methods:

  • IRP_MJ_CREATE
  • IRP_MJ_CLOSE
    • IRP_MJ_READ
    • IRP_MJ_WRITE
    • IRP_MJ_DEVICE_CONTROL
    • IRP_MJ_INTERNAL_CONTROL If an IRP does not belong to the types listed above, it simply returns the IoStatus.Status value. A typical override should have the following structure: switch (IrpSp->MajorFunction) { case IRP_MJ_XXX: return DispatchXXX(...); case IRP_MJ_YYY: return DispatchYYY(...); default: return __super::DispatchRoutine(...); }
      Returns:
      If the return value is STATUS_PENDING, the packet is not touched after the method returns. In other case, the IoStatus.Status field is updated (if it was not set previously) and the packet is sent to the next driver (if one exists).
      Remarks:
      Note that if you inherit any child class of DDK::Driver, you should ensure that if you redefine the DispatchRoutine() in the way preventing some IRPs from being processed by the DispatchRoutine() of your base class, they will really NOT be processed by that class and some corresponding virtual methods will not be called. Please consider that if you want to redefine device behaviour for certain minor codes of a major code handled by parent class, and do not intend to alter other minors, you should call __super::DispatchRoutine() for these minors explicitly. Consider notes on DispatchRoutine() in other classes to see what major codes they handle.

Reimplemented from BazisLib::DDK::PNPDevice.

Reimplemented in BazisLib::DDK::BasicStorageVolume.

virtual NTSTATUS BazisLib::DDK::IODevice::OnClose (  )  [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::IODevice::OnCreate ( PIO_SECURITY_CONTEXT  SecurityContext,
ULONG  Options,
USHORT  FileAttributes,
USHORT  ShareAccess,
PFILE_OBJECT  pFileObj 
) [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::IODevice::OnDeviceControl ( ULONG  ControlCode,
bool  IsInternal,
void *  pUserInputBuffer,
void *  pUserOutputBuffer,
ULONG  InputLength,
ULONG  OutputLength,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_DEVICE_CONTROL or IRP_MJ_INTERNAL_DEVICE_CONTROL packet with Transfer Type bits set to METHOD_NEITHER

Parameters:
pUserInputBuffer Contains the address of the input buffer in USER SPACE!
pUserOutputBuffer Contains the address of the output buffer in USER SPACE!

virtual NTSTATUS BazisLib::DDK::IODevice::OnDeviceControl ( ULONG  ControlCode,
bool  IsInternal,
void *  pInBuffer,
PMDL  InOutBuffer,
ULONG  InputLength,
ULONG  OutputLength,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_DEVICE_CONTROL or IRP_MJ_INTERNAL_DEVICE_CONTROL packet with Transfer Type bits set to METHOD_IN_DIRECT or METHOD_OUT_DIRECT

Parameters:
pInBuffer Contains the address of the system buffer shadowing the input buffer.
InOutBuffer Contains the MDL for the output buffer that can be used for input of output operation depending on the Transfer Type bits in the IOCTL code.

virtual NTSTATUS BazisLib::DDK::IODevice::OnDeviceControl ( ULONG  ControlCode,
bool  IsInternal,
void *  pInOutBuffer,
ULONG  InputLength,
ULONG  OutputLength,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_DEVICE_CONTROL or IRP_MJ_INTERNAL_DEVICE_CONTROL packet with Transfer Type bits set to METHOD_BUFFERED

Reimplemented in BazisLib::DDK::BasicCDVolume, BazisLib::DDK::UniversalVolume, and BazisLib::DDK::StorageDevice.

virtual NTSTATUS BazisLib::DDK::IODevice::OnRead ( PMDL  pMdl,
ULONG  Length,
ULONG  Key,
ULONGLONG  ByteOffset,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_READ packet. And the DO_DIRECT_IO flag is set in the DEVICE_OBJECT::Flags field.

Reimplemented in BazisLib::DDK::BasicStorageVolume.

virtual NTSTATUS BazisLib::DDK::IODevice::OnRead ( void *  pBuffer,
ULONG  Length,
ULONG  Key,
ULONGLONG  ByteOffset,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_READ packet. And the DO_BUFFERED_IO flag is set in the DEVICE_OBJECT::Flags field.

virtual NTSTATUS BazisLib::DDK::IODevice::OnWrite ( PMDL  pMdl,
ULONG  Length,
ULONG  Key,
ULONGLONG  ByteOffset,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_WRITE packet. And the DO_DIRECT_IO flag is set in the DEVICE_OBJECT::Flags field.

Reimplemented in BazisLib::DDK::BasicStorageVolume.

virtual NTSTATUS BazisLib::DDK::IODevice::OnWrite ( const void *  pBuffer,
ULONG  Length,
ULONG  Key,
ULONGLONG  ByteOffset,
PULONG  pBytesDone 
) [inline, protected, virtual]

This method is called when the driver receives an IRP_MJ_WRITE packet. And the DO_BUFFERED_IO flag is set in the DEVICE_OBJECT::Flags field.


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