PSCR.SYS—PCMCIA Smart Card Driver

SUMMARY

This driver is used for the SCM PCMCIA smart card reader.

This driver implements Plug and Play and Power Management.

 

BUILDING PSCR.SYS

To build the Pscr.sys driver, select either the checked or free DDK environment, change to the Bulltlp3 directory, and type build. This driver uses services provided by the smart card driver library (Smclib.sys), which are explained in detail in the accompanying documentation.

To install the driver, simply insert the reader into a PCMCIA slot. The Found New Hardware wizard will appear. You will need to provide the .inf file (on a floppy disk) and the driver file, which will be copied to your System32\Drivers directory. The driver will start automatically. To stop the driver, either eject the reader or select the appropriate taskbar icon. The driver will not unload as long as you have Ifdtest.exe running and connected to the driver.

 

Tools

Microsoft offers a test tool (Ifdtest.exe) that allows you to use a smart card reader directly from the command line. Normally, the smart card resource manager is connected to a reader. To use Ifdtest.exe, you must stop the smart card resource manager (Scardsvr.exe). Type net stop scardsvr in the command line. Ifdtest.exe is also used for the smart card reader logo test.

Ifdtest.exe can be downloaded from http://www.microsoft.com/hwtest (follow the links for smart cards). You need to order special test smart cards to get your smart card reader logo'ed. Ordering information can be found at the URL above.

 

RESOURCES

ISO 7816 Part 3 describes smart cards and smart card protocols in detail. Refer to the PC99 Handbook for smart card reader requirements.

CODE TOUR

File Manifest

 
Files         Description
PSCR.HTM      The documentation for this sample (this file).
SOURCES       The generic file for building the code sample.
MAKEFILE      Makefile required to build the driver.
MAKEFILE.INC  Additional makefile required to build the driver.
PSCR.INF      The INF file for installing the code sample.
PSCRCB.CB     Source file containing the callback functions for the smart card library.
PSCRCB.H      Function prototypes for above file.
PSCRCMD.C     Implements the reader commands.
PSCRLOG.MC    Error messages for this driver.
PSCRNT.C      The main source file (load, unload, Plug and Play, Power Management).
PSCRNT.H      Data definitions and prototypes for the above file.
PSCRRDWR.C    Implements read/write operations.
PSCRRDWR.H    Data definitions and constant definitions for this reader.
PSCRVERS.H    Driver-specific version information.
 

Programming Tour

The major topics covered in this tour are:

Plug and Play

With PCMCIA, Plug and Play is fairly easy to implement, since the PCMCIA bus supports device insertion and removal detection by design. However, when a user removes a PCMCIA card from the slot, an application may still be connected to the device. You should fail all subsequent requests, but you need to prevent the driver from unloading as long as the connection exists. Defer unloading of the driver until the connection has been closed.

Power Management

Power Management is described in detail in the DDK documentation. There is, however, one situation that is specific to smart card readers: how to deal with smart card insertions/removals while the system is in standby or hibernation mode.

Your reader won’t see any card insertion or removal events in these modes, because the bus might not even have power. So you need to save the card state before your reader goes into standby/hibernation mode. After the system comes back from these modes, you need to determine what the state of the card is. You need to complete card tracking calls whenever there was a card in the reader before standby/hibernation mode or whenever there is a card in the reader after these modes. This is necessary because the user could have changed the card while the system is in a low-power mode.

 

Top of page

© 1998 Microsoft Corporation