Bewerken

Delen via


SRBEX_DATA structure (srb.h)

The SRBEX_DATA structure is the generalized format for containing extended SRB data.

Note  The SCSI port driver and SCSI miniport driver models may be altered or unavailable in the future. Instead, we recommend using the Storport driver and Storport miniport driver models.
 

Syntax

typedef struct _SRBEX_DATA {
  SRBEXDATATYPE Type;
  ULONG         Length;
  UCHAR         Data[ANYSIZE_ARRAY];
} SRBEX_DATA, *PSRBEX_DATA;

Members

Type

Data type indicator for the extended SRB data structure. The possible values for Type are one of the following.

Value Meaning
SrbExDataTypeUnknown
The SRB extended data type is unknown.
SrbExDataTypeBidirectional
The SRB extended data is formatted as an SRBEX_DATA_BIDIRECTIONAL structure.
SrbExDataTypeScsiCdb16
The SRB extended data is formatted as an SRBEX_DATA_SCSI_CDB16 structure.
SrbExDataTypeScsiCdb32
The SRB extended data is formatted as an SRBEX_DATA_SCSI_CDB32 structure.
SrbExDataTypeScsiCdbVar
The SRB extended data is formatted as an SRBEX_DATA_SCSI_CDB_VAR structure.
SrbExDataTypeWmi
The SRB extended data is formatted as an SRBEX_DATA_WMI structure.
SrbExDataTypePower
The SRB extended data is formatted as an SRBEX_DATA_POWER structure.
SrbExDataTypePnp
The SRB extended data is formatted as an SRBEX_DATA_PNP structure.
SrbExDataTypeIoInfo
The SRB extended data is formatted as an SRBEX_DATA_IO_INFO structure.

Length

Length of the SRB data, in bytes, present in the Data member.

Data[ANYSIZE_ARRAY]

The extended SRB data block contents.

Remarks

The SRB extended data is present when the SrbExDataOffset array in the STORAGE_REQUEST_BLOCK structure contains valid offset locations. A storage driver initially references a memory offset location contained in SrbExDataOffset as an SRBEX_DATA structure. A pointer to the data block is then cast to the appropriate structure type based on the data type value in the Type member.

The following example code fragment shows how to access the extended data for the SRB function of SRB_FUNCTION_PNP.

BOOLEAN CheckIo( _In_ PSCSI_REQUEST_BLOCK Srb)
{
    BOOLEAN result = TRUE;
    ULONG function;
    PSTORAGE_REQUEST_BLOCK SrbEx = (PSTORAGE_REQUEST_BLOCK)Srb;
    PSRBEX_DATA SrbExData = NULL;

    function = (SrbEx->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK) ? SrbEx->SrbFunction : Srb->Function;

    switch (function)
    {
        case SRB_FUNCTION_PNP:
        {
            STOR_PNP_ACTION PnpAction;
            BOOLEAN ForAdapter;

            if (SrbEx->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
            {
                PSRBEX_DATA_PNP SrbExDataPnp = NULL;

                SrbExData = (PSRBEX_DATA) ((PUCHAR)SrbEx + SrbEx->SrbExDataOffset[0]);
                if (SrbExData->Type == SrbExDataTypePnp)
                {
                    SrbExDataPnp = (PSRBEX_DATA_PNP) SrbExData;
                    ForAdapter = (SrbExDataPnp->SrbPnPFlags == SRB_PNP_FLAGS_ADAPTER_REQUEST);
                    PnpAction = SrbExDataPnp->PnPAction;
                }
                else
                {
                    ForAdapter = FALSE;
                    result = FALSE;
                }
            }
            else
            {
                PSCSI_PNP_REQUEST_BLOCK PnpSrb = (PSCSI_PNP_REQUEST_BLOCK)Srb;

                ForAdapter = (PnpSrb->SrbPnPFlags == SRB_PNP_FLAGS_ADAPTER_REQUEST);
                PnpAction = PnpSrb->PnPAction;
           }

           if (ForAdapter)
           {
               switch (PnpAction)
               {
                   case StorRemoveDevice:
                       //
                       // ...
                       //
                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
                       break;

                   default:
                       Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
                       result = FALSE;
                       break:
            }
        }

        default:
            break; 
    }

    return result;
}

Requirements

Requirement Value
Minimum supported client Available starting with Windows 8.
Header srb.h (include Storport.h, Srb.h, Minitape.h)

See also

SRBEX_DATA_BIDIRECTIONAL

SRBEX_DATA_IO_INFO

SRBEX_DATA_PNP

SRBEX_DATA_POWER

SRBEX_DATA_SCSI_CDB16

SRBEX_DATA_SCSI_CDB32

SRBEX_DATA_SCSI_CDB_VAR

SRBEX_DATA_WMI