#include <device.h>
Inherited by BazisLib::DDK::PNPDevice [protected]
.
Classes | |
struct | Extension |
Public Member Functions | |
Device (DEVICE_TYPE DeviceType=FILE_DEVICE_UNKNOWN, const wchar_t *pwszDeviceName=NULL, ULONG DeviceCharacteristics=FILE_DEVICE_SECURE_OPEN, bool bExclusive=false, ULONG AdditionalDeviceFlags=DO_POWER_PAGABLE) | |
NTSTATUS | RegisterDevice (Driver *pDriver, bool bCompleteInitialization=true, const wchar_t *pwszLinkPath=NULL) |
void | CompleteInitialization () |
NTSTATUS | AttachToDeviceStack (PDEVICE_OBJECT DeviceObject) |
NTSTATUS | AttachToDevice (string &DevicePath) |
NTSTATUS | RegisterInterface (IN CONST GUID *pGuid, IN PCUNICODE_STRING ReferenceString=NULL) |
NTSTATUS | EnableInterface () |
NTSTATUS | DisableInterface () |
NTSTATUS | DetachDevice () |
NTSTATUS | DeleteDevice (bool FromIRPHandler) |
bool | Valid () |
virtual | ~Device () |
Protected Member Functions | |
void | DeleteThisAfterLastRequest () |
bool | ReportInitializationError (NTSTATUS status) |
PDEVICE_OBJECT | GetDeviceObject () |
PDEVICE_OBJECT | GetNextDevice () |
PDEVICE_OBJECT | GetUnderlyingPDO () |
PCUNICODE_STRING | GetInterfaceName () |
Driver * | GetDriver () |
const wchar_t * | GetShortDeviceName () |
bool | SetShortDeviceName (const wchar_t *pwszNewName) |
void | OnPendingIRPCompleted (IN PIRP Irp) |
NTSTATUS | WaitForStopEvent (bool FromIRPHandler) |
NTSTATUS | CallNextDriverSynchronously (IN IncomingIrp *Irp) |
NTSTATUS | CreateDeviceRequestQueue () |
NTSTATUS | EnqueuePacket (IN IncomingIrp *Irp) |
virtual NTSTATUS | DispatchRoutine (IN IncomingIrp *Irp, IO_STACK_LOCATION *IrpSp) |
Static Protected Member Functions | |
static NTSTATUS | EventSettingCompletionRoutine (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context) |
static NTSTATUS | IrpCompletingCompletionRoutine (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context) |
Protected Attributes | |
const char * | m_pszDeviceDebugName |
Private Member Functions | |
void | IncrementIOCount () |
void | DecrementIOCount () |
NTSTATUS | ProcessIRP (IN PIRP Irp, bool bIsPowerIrp) |
NTSTATUS | PostProcessIRP (IncomingIrp *pIrp, NTSTATUS ProcessingStatus, bool FromDispatcherThread) |
NTSTATUS | ForwardPacketToNextDriver (IN IncomingIrp *Irp) |
NTSTATUS | ForwardPacketToNextDriverWithIrpCompletion (IN IncomingIrp *Irp) |
Static Private Member Functions | |
static void | RequestDispatcherThreadBody (IN PVOID pParam) |
Private Attributes | |
DEVICE_TYPE | m_DeviceType |
ULONG | m_DeviceCharacteristics |
ULONG | m_AdditionalDeviceFlags |
bool | m_bExclusive |
const wchar_t * | m_pwszDeviceName |
Driver * | m_pDriver |
bool | m_bDeletePending |
long | m_OutstandingIORequestCount |
KEvent | m_DeleteAllowed |
KEvent | m_StopAllowed |
bool | m_bDestroyObjectAfterLastRequest |
class IrpQueue * | m_pDeviceQueue |
HANDLE | m_hServiceThread |
NTSTATUS | m_InitializationStatus |
PDEVICE_OBJECT | m_pDeviceObject |
PDEVICE_OBJECT | m_pNextDevice |
PDEVICE_OBJECT | m_pUnderlyingPDO |
UNICODE_STRING | m_InterfaceName |
string | m_LinkName |
bool | m_bInterfaceEnabled |
Friends | |
class | Driver |
BazisLib::DDK::Device::Device | ( | DEVICE_TYPE | DeviceType = FILE_DEVICE_UNKNOWN , |
|
const wchar_t * | pwszDeviceName = NULL , |
|||
ULONG | DeviceCharacteristics = FILE_DEVICE_SECURE_OPEN , |
|||
bool | bExclusive = false , |
|||
ULONG | AdditionalDeviceFlags = DO_POWER_PAGABLE | |||
) |
Prepares a new device for creation. Does not call IoCreateDevice().
DeviceType | Contains the type for device | |
pwszDeviceName | Contains the name for the device (without \Device prefix) | |
DeviceCharacteristics | Contains device characteristics passed to IoCreateDevice() | |
bExclusive | Exclusiveness flag passed to IoCreateDevice() | |
AdditionalDeviceFlags | Flags that are set in DEVICE_OBJECT::Flags immediately after device creation. |
virtual BazisLib::DDK::Device::~Device | ( | ) | [virtual] |
NTSTATUS BazisLib::DDK::Device::AttachToDevice | ( | string & | DevicePath | ) |
Attaches the device to another device. If the device is already attached to another device, this method returns STATUS_INVALID_DEVICE_STATE.
NTSTATUS BazisLib::DDK::Device::AttachToDeviceStack | ( | PDEVICE_OBJECT | DeviceObject | ) |
Attaches the device to the highest device object in the chain. If the device is already attached to another device, or CompleteInitialization() was called, this method returns STATUS_INVALID_DEVICE_STATE.
NTSTATUS BazisLib::DDK::Device::CallNextDriverSynchronously | ( | IN IncomingIrp * | Irp | ) | [protected] |
Sends an IRP to the next device (returned by the IoAttachDeviceToDeviceStack() call) and waits for the next driver to process request.
Please avoid using this method as a default handler for IRP types you do not want to handle. Use __super::DispatchRoutine() instead.
void BazisLib::DDK::Device::CompleteInitialization | ( | ) |
Completes the initialization process by clearing the DO_DEVICE_INITIALIZING flag.
NTSTATUS BazisLib::DDK::Device::CreateDeviceRequestQueue | ( | ) | [protected] |
Creates a device request queue allowing subsequent EnqueuePacket() calls. Also creates a dispatcher thread that dequeues IRPs from the queue and processes them. The thread is automatically stopped on device deletion.
void BazisLib::DDK::Device::DecrementIOCount | ( | ) | [private] |
NTSTATUS BazisLib::DDK::Device::DeleteDevice | ( | bool | FromIRPHandler | ) |
Deletes the device from system, previously detaching it from another device, if it was attached. Note that this routine also shuts down the request processing thread, if one has been started. That way, it should be called even if the object is being deleted without calling to IoCreateDevice().
void BazisLib::DDK::Device::DeleteThisAfterLastRequest | ( | ) | [inline, protected] |
NTSTATUS BazisLib::DDK::Device::DetachDevice | ( | ) |
Detaches the device from another device, if it was previously attached. If not, returns an error.
NTSTATUS BazisLib::DDK::Device::DisableInterface | ( | ) |
virtual NTSTATUS BazisLib::DDK::Device::DispatchRoutine | ( | IN IncomingIrp * | Irp, | |
IO_STACK_LOCATION * | IrpSp | |||
) | [inline, protected, virtual] |
Device::DispatchRoutine actually does nothing and returns the IoStatus.Status field of the IRP. All IRP handling functionality is defined in child classes.
Reimplemented in BazisLib::DDK::IODevice, BazisLib::DDK::IODeviceFilter, BazisLib::DDK::PNPDevice, and BazisLib::DDK::BasicStorageVolume.
NTSTATUS BazisLib::DDK::Device::EnableInterface | ( | ) |
NTSTATUS BazisLib::DDK::Device::EnqueuePacket | ( | IN IncomingIrp * | Irp | ) | [protected] |
Enqueues an incoming IRP in the device queue. If the device queue was not previously created using the Device::CreateDeviceRequestQueue() call, this method returns STATUS_INTERNAL_ERROR.
static NTSTATUS BazisLib::DDK::Device::EventSettingCompletionRoutine | ( | IN PDEVICE_OBJECT | DeviceObject, | |
IN PIRP | Irp, | |||
IN PVOID | Context | |||
) | [static, protected] |
NTSTATUS BazisLib::DDK::Device::ForwardPacketToNextDriver | ( | IN IncomingIrp * | Irp | ) | [private] |
Skips current stack location and calls the next driver in chain. If no such driver exists, the routine completes IRP and returns the value of Irp->IoStatus.Status.
Note that if you cannot use this routine in the following way:
return ForwardPacketToNextDriver(Irp); //!!!BAD!!!If this routine returns STATUS_PENDING, your method will also return STATUS_PENDING and nobody will be responsible for decrementing outstanding I/O operation count.
This method is fully PowerIRP-aware.
NTSTATUS BazisLib::DDK::Device::ForwardPacketToNextDriverWithIrpCompletion | ( | IN IncomingIrp * | Irp | ) | [private] |
Sends an IRP to the next device (returned by the IoAttachDeviceToDeviceStack() call) and completes the IRP using IoCompleteRequest() call. This routine is used for completing dequeued IRPs.
Please avoid using this method as a default handler for IRP types you do not want to handle. Use __super::DispatchRoutine() instead.
PDEVICE_OBJECT BazisLib::DDK::Device::GetDeviceObject | ( | ) | [inline, protected] |
Reimplemented in BazisLib::DDK::BusPDO.
Driver* BazisLib::DDK::Device::GetDriver | ( | ) | [inline, protected] |
PCUNICODE_STRING BazisLib::DDK::Device::GetInterfaceName | ( | ) | [inline, protected] |
PDEVICE_OBJECT BazisLib::DDK::Device::GetNextDevice | ( | ) | [inline, protected] |
const wchar_t* BazisLib::DDK::Device::GetShortDeviceName | ( | ) | [inline, protected] |
PDEVICE_OBJECT BazisLib::DDK::Device::GetUnderlyingPDO | ( | ) | [inline, protected] |
void BazisLib::DDK::Device::IncrementIOCount | ( | ) | [private] |
static NTSTATUS BazisLib::DDK::Device::IrpCompletingCompletionRoutine | ( | IN PDEVICE_OBJECT | DeviceObject, | |
IN PIRP | Irp, | |||
IN PVOID | Context | |||
) | [static, protected] |
void BazisLib::DDK::Device::OnPendingIRPCompleted | ( | IN PIRP | Irp | ) | [inline, protected] |
NTSTATUS BazisLib::DDK::Device::PostProcessIRP | ( | IncomingIrp * | pIrp, | |
NTSTATUS | ProcessingStatus, | |||
bool | FromDispatcherThread | |||
) | [private] |
NTSTATUS BazisLib::DDK::Device::ProcessIRP | ( | IN PIRP | Irp, | |
bool | bIsPowerIrp | |||
) | [private] |
NTSTATUS BazisLib::DDK::Device::RegisterDevice | ( | Driver * | pDriver, | |
bool | bCompleteInitialization = true , |
|||
const wchar_t * | pwszLinkPath = NULL | |||
) |
Creates and registers the system device using IoCreateDevice()
CreateDosDevicesLink | Specifies whether to create a symbollic link in | |
CompleteInitialization | Specifies whether to mark device as initialized | |
pDriver | Specifies the driver object used in device creation, or NULL to use the main driver. |
NTSTATUS BazisLib::DDK::Device::RegisterInterface | ( | IN CONST GUID * | pGuid, | |
IN PCUNICODE_STRING | ReferenceString = NULL | |||
) |
bool BazisLib::DDK::Device::ReportInitializationError | ( | NTSTATUS | status | ) | [protected] |
static void BazisLib::DDK::Device::RequestDispatcherThreadBody | ( | IN PVOID | pParam | ) | [static, private] |
bool BazisLib::DDK::Device::SetShortDeviceName | ( | const wchar_t * | pwszNewName | ) | [protected] |
bool BazisLib::DDK::Device::Valid | ( | ) |
Reimplemented in BazisLib::DDK::Filter, BazisLib::DDK::PNPDevice, BazisLib::DDK::StorageDevice, and BazisLib::DDK::BasicStorageVolume.
NTSTATUS BazisLib::DDK::Device::WaitForStopEvent | ( | bool | FromIRPHandler | ) | [protected] |
friend class Driver [friend] |
ULONG BazisLib::DDK::Device::m_AdditionalDeviceFlags [private] |
bool BazisLib::DDK::Device::m_bDeletePending [private] |
bool BazisLib::DDK::Device::m_bDestroyObjectAfterLastRequest [private] |
bool BazisLib::DDK::Device::m_bExclusive [private] |
bool BazisLib::DDK::Device::m_bInterfaceEnabled [private] |
KEvent BazisLib::DDK::Device::m_DeleteAllowed [private] |
ULONG BazisLib::DDK::Device::m_DeviceCharacteristics [private] |
DEVICE_TYPE BazisLib::DDK::Device::m_DeviceType [private] |
Reimplemented in BazisLib::DDK::BusPDO.
HANDLE BazisLib::DDK::Device::m_hServiceThread [private] |
NTSTATUS BazisLib::DDK::Device::m_InitializationStatus [private] |
UNICODE_STRING BazisLib::DDK::Device::m_InterfaceName [private] |
string BazisLib::DDK::Device::m_LinkName [private] |
long BazisLib::DDK::Device::m_OutstandingIORequestCount [private] |
PDEVICE_OBJECT BazisLib::DDK::Device::m_pDeviceObject [private] |
class IrpQueue* BazisLib::DDK::Device::m_pDeviceQueue [private] |
Driver* BazisLib::DDK::Device::m_pDriver [private] |
PDEVICE_OBJECT BazisLib::DDK::Device::m_pNextDevice [private] |
const char* BazisLib::DDK::Device::m_pszDeviceDebugName [protected] |
PDEVICE_OBJECT BazisLib::DDK::Device::m_pUnderlyingPDO [private] |
const wchar_t* BazisLib::DDK::Device::m_pwszDeviceName [private] |
KEvent BazisLib::DDK::Device::m_StopAllowed [private] |