The following figure shows the calling scheme of an IOCTL call:
This is the process that takes place in the calling scheme:
The resource manager calls the driver (1). The driver calls the library (2). The library checks the parameters of this call. If the driver's help is not needed to satisfy the call, the library returns the requested data, or an error code, to the caller (3a). If the driver's help is needed to satisfy the call, for example if I/O is required or if this is a vendor-specific call, the library calls the driver with all parameters set up correctly (3b). The driver performs I/O and uses support functions of the library (4 and 5). The driver then completes the request and returns the call to the resource manager (6).
The smart card library synchronizes access to your driver. No two callback functions will be called at the same time. However, card insertion and removal event handling must be processed asynchronously.