The Windows 2000/XP sample consists of 3 modules –functional driver sample, filter driver sample, and application sample, which demonstrate communication with functional drive.
Windows 2000/XP PnP subsystem doesn’t include Card Services. Drivers for PC Cards work via standard PnP subsystem. The functional driver consists of 2 parts – standard PnP device base class (it can be used for any PnP device) and derived class, which implements PC Card specific features. During startup the driver registers the AddDevice routine. On card insertion the PnP manager will call this routine, passing the PDO to it. Inside of this routine the driver creates a functional device object for the PDO. This object processes the IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP, and demonstrates the creation of a resource list. This is useful for memory cards, as the PC Card bus driver doesn’t create a resource list for such cards. During the device processing start, the driver gets the PC Card standard and bus interfaces, from the PDO. These interfaces are useful when accessing CIS, and for memory card specific manipulations (setting VPP, mapping memory window, and checking write-protection). In addition, the driver demonstrates the handling of IRP_MJ_READ and IRP_MJ_WRITE IRPs, which are required for memory cards.
The driver’s IRP_MJ_DEVICE_CONTROL handler demonstrates communications with the user-mode sample application. Sample IOCTLs demonstrate retrieving the DEVICE ID, using an IRP_MN_QUERY_ID request. One IOCTL demonstrates synchronous processing of request, and the other asynchronous processing.
To adapt code of the driver to your card, please, modify card ID in FUNCDRV.INF file to reflect your card’s ID.
Sample Filter Driver
The filter driver is the standard PnP driver, which receives all IRPs. Not all IRPs are processed; these should be passed down the device stack. The sample filter driver uses the same core as the functional driver, but in the derived class standard filter technique demonstrated. The driver processes all IRPs, except IRP_MJ_PNP and IRP_MJ_POWER; these are passed down the device stack. PnP and power requests, are supported by the core algorithm. In addition, the driver processes the IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP; during which time the driver corrects resources assigned to the device by the functional driver.
To adapt code of the driver to your card, please, modify card ID in FLTDRV.INF file to reflect your card’s ID.
The sample application was specially written to demonstrate the communication with the sample functional driver. It is possible to send synchronous or asynchronous requests to the driver.