Smart Card Driver Debugging (Windows Embedded CE 6.0)


The Smart Card Driver Library supports several debugging technologies. These technologies let you see what the library does internally and let you write debugging output to a connected debugger. The header file Smclib.h defines the following constants used for debugging:

#define DEBUG_IOCTL     ((ULONG) 0x00000001)
#define DEBUG_ATR       ((ULONG) 0x00000002)
#define DEBUG_PROTOCOL  ((ULONG) 0x00000004)
#define DEBUG_DRIVER    ((ULONG) 0x00000008)
#define DEBUG_TRACE     ((ULONG) 0x00000010)
#define DEBUG_ERROR     ((ULONG) 0x00000020)
#define DEBUG_T1_TEST   ((ULONG) 0x40000000)
#define DEBUG_BREAK     ((ULONG) 0x80000000)
#define DEBUG_ALL       ((ULONG) 0x0000FFFF)

These can be used to select the level of debugging that you want. In your driver, provide a mask of constants that are combined with the bitwise OR operator to select the level of debugging that you want. You must have the debug version of the driver to get debugging messages.

To write your own driver debugging messages, it is recommended that you use SmartcardDebug(ULONG DebugLevel, PCHAR Message);.

This lets you write messages to the remote debugger. On the run-time image, the SmartcardDebug macro translates directly to the DEBUGMSG macros used to write debug messages to the console. For error messages, use the constant DEBUG_ERROR for the debug level. To write standard driver messages, use the constant DEBUG_DRIVER. To write trace messages, such as when entering and exiting a function, use DEBUG_TRACE as the debug level.

Community Additions