How to Enable SCSIPORT Debug Logging

Support for Windows XP has ended

Microsoft ended support for Windows XP on April 8, 2014. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

This article has been archived. It is offered "as is" and will no longer be updated.
This article describes how you can enable debug logging for the SCSIPORT and SCSI miniport driver on Microsoft Windows XP, Microsoft Windows 2000 and Microsoft Windows NT.
More information
To enable debug logs you must have a kernel debugger connected to the target computer and the appropriate symbol files. Also, debug logging only works in a checked or debug build of the operating system. This method will not work on free or retail builds of the operating system.

Windows NT and Windows 2000

On Windows 2000 and Windows NT, you can obtain verbose debug tracing from the SCSIPORT driver by setting the ScsiDebug global variable to 3 with a kernel debugger. For example:
  1. Set the debugger to debug the target computer.
  2. Break into the target computer through the debugger connected to the host computer.
  3. Edit the ScsiDebug flag so that it looks like:
    kd >ed Scsiport!ScsiDebug 3kd >g					

Windows XP

Debug printing on Windows XP has changed from previous versions. Drivers now use a new function named DbgPrintEx to print debug messages. The DbgPrintEx function either passes the specified string to the kernel debugger or does nothing at all, depending on the values of ComponentID, Level, and the corresponding component filter masks.

The mask for the SCSIPORT driver is Kd_ScsiPort_Mask, and the mask for the SCSI miniport driver is Kd_ScsiMiniport_Mask. To get the logs from SCSIPORT and SCSI miniport, follow these steps:
  1. Set the debugger to debug the target computer.
  2. Break into the target computer through the debugger connected to the host computer.
  3. Edit the Kd_ScsiPort_Mask and Kd_ScsiMiniport_Mask flags so that they look like:
        kd >ed NT!Kd_ScsiPort_Mask 3    kd >ed NT!Kd_ScsiMiniport_Mask 3    kd >g					
Both the Kd_ScsiPort_Mask and Kd_ScsiMiniPort_Mask are 32-bit Mask variables. The lower 4 bits control the level of debug logging. Setting the appropriate bit enables the required level of debugging.

This table shows the bit, value and description of the four bits:
    Bit    Value  Description    ------------------------------------------     0       1    Error Level (Always printed)     1       2    Warning Level     2       4    Trace Level     3       8    Info Level				
To obtain debug logs from multiple levels, set bit values for all the required levels. For example, to get logs for both the Error and Warning level, set bits 0 & 1 to 1. This results in setting the debug flag to 3.
For more information about the DbgPrintEx API, refer to the Microsoft Windows XP Device Driver Kit (DDK) documentation.
Kd_ScsiMiniport_Mask Kd_ScsiPort_Mask ScsiDebug DbgPrintEx

Article ID: 296225 - Last Review: 01/11/2015 04:09:42 - Revision: 3.0

Microsoft Windows 2000 Server, Microsoft Windows NT Server 4.0 Standard Edition, Microsoft Windows NT Workstation 4.0 Developer Edition, Microsoft Windows NT Server 4.0 Enterprise Edition, Microsoft Windows XP Professional

  • kbnosurvey kbarchive kbbug kbdebug kbhowto kbstoragedev KB296225