AddDevice role is to construct a filter instance. The key code in Device class. In this class, we have to insert the device stack filter and block IRP, complete with their own routines to achieve a particular function.
Code:
UsbFilterDevice:: UsbFilterDevice (PDEVICE_OBJECT Pdo, ULONG Unit123):
KWdmFilterDevice (Pdo123, NULL)
{
T << "UsbFilterDevice:: UsbFilterDevice \ n";
if (! NT_SUCCESS (m_ConstructorStatus))
{
return;
}
m_Unit = Unit;
m_Usb.Initialize (this, Pdo);
NTSTATUS status = AttachFilter (& m_Usb);
if (! NT_SUCCESS (status))
{
m_ConstructorStatus123 = status;
return;
}
SetFiltERPowerPolicy ();
SetFilterPnpPolicy ();
}
Bookmarks