BazisLib::DDK::PNPDevice Class Reference

#include <pnpdevice.h>

Inherits BazisLib::DDK::Device.

Inherited by BazisLib::DDK::BusPDO [protected], BazisLib::DDK::Filter [protected], and BazisLib::DDK::IODevice.

Collaboration diagram for BazisLib::DDK::PNPDevice:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PNPDevice (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)
NTSTATUS AddDevice (Driver *pDriver, PDEVICE_OBJECT PhysicalDeviceObject, const GUID *pInterfaceGuid=NULL, const wchar_t *pwszLinkPath=NULL)
bool Valid ()
virtual ~PNPDevice ()

Static Public Member Functions

static void * RequestInterface (PDEVICE_OBJECT pDevice, LPCGUID lpGuid, unsigned Version, PVOID pSpecificData=NULL)

Protected Member Functions

void SetNewPNPState (DevicePNPState NewState)
void RestorePreviousPNPState ()
DevicePNPState GetCurrentPNPState ()
void * RequestInterfaceFromUnderlyingDevice (LPCGUID lpGuid, unsigned Version, PVOID pSpecificData=NULL)
 Requests an interface from an underlying PDO.
NTSTATUS ReportStateChange (const GUID &Event, PVOID pAdditionalData=NULL, ULONG AdditionalDataSize=0)
 Reports device state change to PnP manager.
virtual NTSTATUS OnStartDevice (IN PCM_RESOURCE_LIST AllocatedResources, IN PCM_RESOURCE_LIST AllocatedResourcesTranslated)
virtual NTSTATUS OnSurpriseRemoval ()
virtual NTSTATUS OnRemoveDevice (NTSTATUS LowerDeviceRemovalStatus)
virtual NTSTATUS OnStopDevice ()
virtual NTSTATUS OnQueryStopDevice ()
virtual NTSTATUS OnCancelStopDevice ()
virtual NTSTATUS OnQueryRemoveDevice ()
virtual NTSTATUS OnCancelRemoveDevice ()
virtual NTSTATUS OnQueryPNPDeviceState (PNP_DEVICE_STATE *pState)
virtual NTSTATUS OnDeviceUsageNotification (bool InPath, DEVICE_USAGE_NOTIFICATION_TYPE Type)
virtual NTSTATUS OnSetPower (POWER_STATE_TYPE Type, POWER_STATE State, POWER_ACTION ShutdownType)
virtual NTSTATUS OnQueryPower (POWER_STATE_TYPE Type, POWER_STATE State, POWER_ACTION ShutdownType)
virtual NTSTATUS DispatchPower (IN IncomingIrp *Irp, IO_STACK_LOCATION *IrpSp)
virtual NTSTATUS DispatchPNP (IN IncomingIrp *Irp, IO_STACK_LOCATION *IrpSp)
virtual NTSTATUS DispatchRoutine (IN IncomingIrp *Irp, IO_STACK_LOCATION *IrpSp) override

Private Attributes

DevicePNPState m_CurrentPNPState
DevicePNPState m_PreviousPNPState
bool m_bDeleteThisAfterRemoveRequest


Constructor & Destructor Documentation

BazisLib::DDK::PNPDevice::PNPDevice ( 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::PNPDevice::~PNPDevice (  )  [virtual]


Member Function Documentation

NTSTATUS BazisLib::DDK::PNPDevice::AddDevice ( Driver pDriver,
PDEVICE_OBJECT  PhysicalDeviceObject,
const GUID pInterfaceGuid = NULL,
const wchar_t *  pwszLinkPath = NULL 
)

Reimplemented in BazisLib::DDK::StorageDevice.

virtual NTSTATUS BazisLib::DDK::PNPDevice::DispatchPNP ( IN IncomingIrp Irp,
IO_STACK_LOCATION *  IrpSp 
) [protected, virtual]

Actual handler for IRP_MJ_PNP requests.

Reimplemented in BazisLib::DDK::BusDevice, and BazisLib::DDK::BusPDO.

virtual NTSTATUS BazisLib::DDK::PNPDevice::DispatchPower ( IN IncomingIrp Irp,
IO_STACK_LOCATION *  IrpSp 
) [protected, virtual]

Actual handler for IRP_MJ_POWER requests.

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

IRP handler for Plug-and-play device. Handles IRP_MJ_PNP requests by calling DispatchPNP().

Reimplemented from BazisLib::DDK::Device.

Reimplemented in BazisLib::DDK::IODevice, BazisLib::DDK::IODeviceFilter, and BazisLib::DDK::BasicStorageVolume.

DevicePNPState BazisLib::DDK::PNPDevice::GetCurrentPNPState (  )  [inline, protected]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnCancelRemoveDevice (  )  [protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnCancelStopDevice (  )  [protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnDeviceUsageNotification ( bool  InPath,
DEVICE_USAGE_NOTIFICATION_TYPE  Type 
) [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnQueryPNPDeviceState ( PNP_DEVICE_STATE *  pState  )  [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnQueryPower ( POWER_STATE_TYPE  Type,
POWER_STATE  State,
POWER_ACTION  ShutdownType 
) [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnQueryRemoveDevice (  )  [protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnQueryStopDevice (  )  [protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnRemoveDevice ( NTSTATUS  LowerDeviceRemovalStatus  )  [protected, virtual]

Called when IRP_MN_REMOVE_DEVICE is received. Disables the device interface and deletes the device object. The OnRemoveDevice() minihandler is called after the lower driver processes the IRP.

Parameters:
LowerDeviceRemovalStatus Contains the status returned by lower driver.
Consider the following method structure when writing an override:

<<< Perform actual cleanup >>> status = ... if (NT_SUCCESS(status)) return __super::OnRemoveDevice(LowerDeviceRemovalStatus);

Additionally, if you want to report an error code, do it AFTER calling __super::OnRemoveDevice():

NTSTATUS status2 = __super::OnRemoveDevice(LowerDeviceRemovalStatus); if (!NT_SUCCESS(status2)) return status2;

return status;

Reimplemented in BazisLib::DDK::BusDevice, and BazisLib::DDK::BusPDO.

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnSetPower ( POWER_STATE_TYPE  Type,
POWER_STATE  State,
POWER_ACTION  ShutdownType 
) [inline, protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnStartDevice ( IN PCM_RESOURCE_LIST  AllocatedResources,
IN PCM_RESOURCE_LIST  AllocatedResourcesTranslated 
) [protected, virtual]

Called when IRP_MN_START_DEVICE is received. Enables the device interface and returns STATUS_SUCCESS. If this method returns an unsuccessful status, the device would not be marked as started.

Consider the following method structure when writing an override: NTSTATUS status = __super::OnStartDevice(...); if (!NT_SUCCESS(status)) return status;

<<< Perform actual initialization >>>

status = ... ; return status;

Reimplemented in BazisLib::DDK::UniversalVolume.

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnStopDevice (  )  [protected, virtual]

virtual NTSTATUS BazisLib::DDK::PNPDevice::OnSurpriseRemoval (  )  [protected, virtual]

Reimplemented in BazisLib::DDK::BusDevice.

NTSTATUS BazisLib::DDK::PNPDevice::ReportStateChange ( const GUID Event,
PVOID  pAdditionalData = NULL,
ULONG  AdditionalDataSize = 0 
) [protected]

Reports device state change to PnP manager.

This method sends an asynchronous message to the PnP manager reporting the device state change. The exact type of the message is determined by the Event parameter.

Parameters:
Event Specifies the event type. Event type GUIDs are defined in the ioevent.h file (for example, GUID_IO_MEDIA_ARRIVAL).

static void* BazisLib::DDK::PNPDevice::RequestInterface ( PDEVICE_OBJECT  pDevice,
LPCGUID  lpGuid,
unsigned  Version,
PVOID  pSpecificData = NULL 
) [static]

void* BazisLib::DDK::PNPDevice::RequestInterfaceFromUnderlyingDevice ( LPCGUID  lpGuid,
unsigned  Version,
PVOID  pSpecificData = NULL 
) [protected]

Requests an interface from an underlying PDO.

This method is used to request the PDO provided by BusPDO class. Calling this method results in invoking the BusPDO::CreateObjectByInterfaceID() method via the IRP_MN_QUERY_INTERFACE call.

Remarks:
If the underlying PDO is not provided by BazisLib, or the interface is not supported, the function will return NULL.

void BazisLib::DDK::PNPDevice::RestorePreviousPNPState (  )  [inline, protected]

void BazisLib::DDK::PNPDevice::SetNewPNPState ( DevicePNPState  NewState  )  [inline, protected]

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

Reimplemented from BazisLib::DDK::Device.

Reimplemented in BazisLib::DDK::Filter, BazisLib::DDK::StorageDevice, and BazisLib::DDK::BasicStorageVolume.

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