ReactOS  0.4.15-dev-1207-g698a8e6
srbhelper.h File Reference
#include <scsi.h>
#include <srb.h>
Include dependency graph for srbhelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SRBHELPER_ASSERT   NT_ASSERT
 
#define SRB_ALIGN_SIZEOF(x)   (((ULONG_PTR)(sizeof(x) + sizeof(PVOID) - 1)) & ~(sizeof(PVOID) - 1))
 
#define SrbMoveMemory(Destination, Source, Length)   memmove(Destination, Source, Length)
 
#define SrbCopyMemory(Destination, Source, Length)   memcpy(Destination, Source, Length)
 
#define SrbZeroMemory(Destination, Length)   memset(Destination, 0, Length)
 
#define SrbEqualMemory(Source1, Source2, Length)   (memcmp(Source1, Source2, Length) == 0)
 
#define SrbSetRequestTag   SrbSetQueueTag
 
#define SrbGetRequestTag   SrbGetQueueTag
 
#define SrbGetQueueAction   SrbGetRequestAttribute
 
#define SrbSetQueueAction   SrbSetRequestAttribute
 

Functions

FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByIndex (_In_ PSTORAGE_REQUEST_BLOCK Srb, _In_ ULONG SrbExDataIndex)
 
FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByType (_In_ PSTORAGE_REQUEST_BLOCK Srb, _In_ SRBEXDATATYPE Type)
 
FORCEINLINE PSRBEX_DATA SrbGetPrimarySrbExData (_In_ PSTORAGE_REQUEST_BLOCK Srb)
 
FORCEINLINE PSTOR_ADDRESS SrbGetAddress (_In_ PSTORAGE_REQUEST_BLOCK Srb)
 
FORCEINLINE BOOLEAN SrbCopySrb (_In_ PVOID DestinationSrb, _In_ ULONG DestinationSrbLength, _In_ PVOID SourceSrb)
 
FORCEINLINE VOID SrbZeroSrb (_In_ PVOID Srb)
 
FORCEINLINE ULONG SrbGetSrbLength (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetSrbLength (_In_ PVOID Srb, _In_ ULONG Length)
 
FORCEINLINE ULONG SrbGetDefaultSrbLengthFromFunction (_In_ ULONG SrbFunction)
 
FORCEINLINE PCDB SrbGetScsiData (_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
 
FORCEINLINE VOID SrbSetScsiData (_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
 
FORCEINLINE PCDB SrbGetCdb (_In_ PVOID Srb)
 
FORCEINLINE ULONG SrbGetSrbFunction (_In_ PVOID Srb)
 
FORCEINLINE PVOID SrbGetSenseInfoBuffer (_In_ PVOID Srb)
 
FORCEINLINE UCHAR SrbGetSenseInfoBufferLength (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetSenseInfoBuffer (_In_ PVOID Srb, _In_opt_ PVOID SenseInfoBuffer)
 
FORCEINLINE VOID SrbSetSenseInfoBufferLength (_In_ PVOID Srb, _In_ UCHAR SenseInfoBufferLength)
 
FORCEINLINE PVOID SrbGetOriginalRequest (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetOriginalRequest (_In_ PVOID Srb, _In_opt_ PVOID OriginalRequest)
 
FORCEINLINE PVOID SrbGetDataBuffer (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetDataBuffer (_In_ PVOID Srb, _In_opt_ __drv_aliasesMem PVOID DataBuffer)
 
FORCEINLINE ULONG SrbGetDataTransferLength (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetDataTransferLength (_In_ PVOID Srb, _In_ ULONG DataTransferLength)
 
FORCEINLINE ULONG SrbGetTimeOutValue (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetTimeOutValue (_In_ PVOID Srb, _In_ ULONG TimeOutValue)
 
FORCEINLINE VOID SrbSetQueueSortKey (_In_ PVOID Srb, _In_ ULONG QueueSortKey)
 
FORCEINLINE VOID SrbSetQueueTag (_In_ PVOID Srb, _In_ ULONG QueueTag)
 
FORCEINLINE ULONG SrbGetQueueTag (_In_ PVOID Srb)
 
FORCEINLINE PVOID SrbGetNextSrb (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetNextSrb (_In_ PVOID Srb, _In_opt_ PVOID NextSrb)
 
FORCEINLINE ULONG SrbGetSrbFlags (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbAssignSrbFlags (_In_ PVOID Srb, _In_ ULONG Flags)
 
FORCEINLINE VOID SrbSetSrbFlags (_In_ PVOID Srb, _In_ ULONG Flags)
 
FORCEINLINE VOID SrbClearSrbFlags (_In_ PVOID Srb, _In_ ULONG Flags)
 
FORCEINLINE ULONG SrbGetSystemStatus (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetSystemStatus (_In_ PVOID Srb, _In_ ULONG Status)
 
FORCEINLINE UCHAR SrbGetScsiStatus (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetScsiStatus (_In_ PVOID Srb, _In_ UCHAR ScsiStatus)
 
FORCEINLINE UCHAR SrbGetCdbLength (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetCdbLength (_In_ PVOID Srb, _In_ UCHAR CdbLength)
 
FORCEINLINE ULONG SrbGetRequestAttribute (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetRequestAttribute (_In_ PVOID Srb, _In_ UCHAR RequestAttribute)
 
FORCEINLINE UCHAR SrbGetPathId (_In_ PVOID Srb)
 
FORCEINLINE UCHAR SrbGetTargetId (_In_ PVOID Srb)
 
FORCEINLINE UCHAR SrbGetLun (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbGetPathTargetLun (_In_ PVOID Srb, _In_opt_ PUCHAR PathId, _In_opt_ PUCHAR TargetId, _In_opt_ PUCHAR Lun)
 
FORCEINLINE PVOID SrbGetMiniportContext (_In_ PVOID Srb)
 
FORCEINLINE UCHAR SrbGetSrbStatus (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetSrbStatus (_In_ PVOID Srb, _In_ UCHAR status)
 
FORCEINLINE PVOID SrbGetPortContext (_In_ PVOID Srb)
 
FORCEINLINE VOID SrbSetPortContext (_In_ PVOID Srb, _In_ PVOID PortContext)
 

Macro Definition Documentation

◆ SRB_ALIGN_SIZEOF

#define SRB_ALIGN_SIZEOF (   x)    (((ULONG_PTR)(sizeof(x) + sizeof(PVOID) - 1)) & ~(sizeof(PVOID) - 1))

Definition at line 16 of file srbhelper.h.

◆ SrbCopyMemory

#define SrbCopyMemory (   Destination,
  Source,
  Length 
)    memcpy(Destination, Source, Length)

Definition at line 30 of file srbhelper.h.

◆ SrbEqualMemory

#define SrbEqualMemory (   Source1,
  Source2,
  Length 
)    (memcmp(Source1, Source2, Length) == 0)

Definition at line 42 of file srbhelper.h.

◆ SrbGetQueueAction

#define SrbGetQueueAction   SrbGetRequestAttribute

Definition at line 1127 of file srbhelper.h.

◆ SrbGetRequestTag

#define SrbGetRequestTag   SrbGetQueueTag

Definition at line 888 of file srbhelper.h.

◆ SRBHELPER_ASSERT

#define SRBHELPER_ASSERT   NT_ASSERT

Definition at line 12 of file srbhelper.h.

◆ SrbMoveMemory

#define SrbMoveMemory (   Destination,
  Source,
  Length 
)    memmove(Destination, Source, Length)

Definition at line 24 of file srbhelper.h.

◆ SrbSetQueueAction

#define SrbSetQueueAction   SrbSetRequestAttribute

Definition at line 1147 of file srbhelper.h.

◆ SrbSetRequestTag

#define SrbSetRequestTag   SrbSetQueueTag

Definition at line 869 of file srbhelper.h.

◆ SrbZeroMemory

#define SrbZeroMemory (   Destination,
  Length 
)    memset(Destination, 0, Length)

Definition at line 36 of file srbhelper.h.

Function Documentation

◆ SrbAssignSrbFlags()

◆ SrbClearSrbFlags()

FORCEINLINE VOID SrbClearSrbFlags ( _In_ PVOID  Srb,
_In_ ULONG  Flags 
)

Definition at line 982 of file srbhelper.h.

985 {
987 
988  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
989  {
990  srb->SrbFlags &= ~Flags;
991  }
992  else
993  {
994  ((PSCSI_REQUEST_BLOCK)srb)->SrbFlags &= ~Flags;
995  }
996 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClassIoComplete(), DeviceProcessDsmTrimRequest(), FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(), RetryRequest(), and RetryTransferPacket().

◆ SrbCopySrb()

FORCEINLINE BOOLEAN SrbCopySrb ( _In_ PVOID  DestinationSrb,
_In_ ULONG  DestinationSrbLength,
_In_ PVOID  SourceSrb 
)

Definition at line 159 of file srbhelper.h.

163 {
164  PSTORAGE_REQUEST_BLOCK sourceSrb = (PSTORAGE_REQUEST_BLOCK)SourceSrb;
165  BOOLEAN status = FALSE;
166 
167  if (sourceSrb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
168  {
169  if (DestinationSrbLength >= sourceSrb->SrbLength)
170  {
171  SrbCopyMemory(DestinationSrb, SourceSrb, sourceSrb->SrbLength);
172  status = TRUE;
173  }
174  }
175  else
176  {
177  if (DestinationSrbLength >= SCSI_REQUEST_BLOCK_SIZE)
178  {
179  SrbCopyMemory(DestinationSrb, SourceSrb, SCSI_REQUEST_BLOCK_SIZE);
180  status = TRUE;
181  }
182  }
183 
184  return status;
185 }
#define TRUE
Definition: types.h:120
#define SrbCopyMemory(Destination, Source, Length)
Definition: srbhelper.h:30
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
#define SCSI_REQUEST_BLOCK_SIZE
Definition: srb.h:274
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ SrbGetAddress()

Definition at line 139 of file srbhelper.h.

140 {
141  PSTOR_ADDRESS storAddr = NULL;
142 
143  if (Srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
144  {
145  SRBHELPER_ASSERT(Srb->AddressOffset);
146 
147  if (Srb->AddressOffset)
148  {
149  storAddr = (PSTOR_ADDRESS)((PUCHAR)Srb + Srb->AddressOffset);
150  SRBHELPER_ASSERT(storAddr->Type == STOR_ADDRESS_TYPE_BTL8);
151  }
152  }
153 
154  return storAddr;
155 }
#define STOR_ADDRESS_TYPE_BTL8
Definition: scsi.h:3525
struct STOR_ADDRESS_ALIGN _STOR_ADDRESS * PSTOR_ADDRESS
unsigned char * PUCHAR
Definition: retypes.h:3
smooth NULL
Definition: ftsmooth.c:416
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by SrbGetLun(), SrbGetPathId(), SrbGetPathTargetLun(), and SrbGetTargetId().

◆ SrbGetCdb()

FORCEINLINE PCDB SrbGetCdb ( _In_ PVOID  Srb)

Definition at line 583 of file srbhelper.h.

585 {
587  PCDB pCdb = NULL;
588 
589  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
590  {
591  return SrbGetScsiData(srb, NULL, NULL, NULL, NULL, NULL);
592  }
593  else
594  {
595  pCdb = (PCDB)((PSCSI_REQUEST_BLOCK)srb)->Cdb;
596  }
597  return pCdb;
598 }
Definition: cdrw_hw.h:28
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
union _CDB * PCDB
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
Definition: scratch.h:156
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
FORCEINLINE PCDB SrbGetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:272

Referenced by _IRQL_requires_max_(), ClassDeviceControl(), ClassDeviceHwFirmwareActivateProcess(), ClassDeviceHwFirmwareDownloadProcess(), ClassGetLBProvisioningLogPage(), ClassInterpretSenseInfo(), ClasspBuildRequestEx(), ClasspCleanupProtectedLocks(), ClasspDeviceGetBlockDeviceCharacteristicsVPDPage(), ClasspDeviceGetBlockLimitsVPDPage(), ClasspDeviceGetLBProvisioningVPDPage(), ClasspEjectionControl(), ClasspGetBlockDeviceTokenLimitsInfo(), ClasspGetInquiryVpdSupportInfo(), ClasspPersistentReserve(), ClasspPowerDownCompletion(), ClasspPowerUpCompletion(), ClasspPrepareMcnIrp(), ClasspReceivePopulateTokenInformation(), ClasspReceiveWriteUsingTokenInformation(), ClasspTransferPacketGetCdb(), ClasspWriteCacheProperty(), ClassReadCapacity16(), ClassSendStartUnit(), DbgGetScsiOpStr(), DeviceProcessDsmTrimRequest(), GetLBAStatus(), RetryTransferPacket(), SetupDriveCapacityTransferPacket(), SetupEjectionTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), SetupReadWriteTransferPacket(), USBSTOR_HandleExecuteSCSI(), and USBSTOR_IssueRequestSense().

◆ SrbGetCdbLength()

FORCEINLINE UCHAR SrbGetCdbLength ( _In_ PVOID  Srb)

Definition at line 1074 of file srbhelper.h.

1076 {
1078  UCHAR CdbLength = 0;
1079 
1080  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1081  {
1082  SrbGetScsiData(srb, &CdbLength, NULL, NULL, NULL, NULL);
1083  }
1084  else
1085  {
1086  CdbLength = ((PSCSI_REQUEST_BLOCK)srb)->CdbLength;
1087  }
1088  return CdbLength;
1089 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
FORCEINLINE PCDB SrbGetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:272

Referenced by ClassInterpretSenseInfo(), ClasspReceivePopulateTokenInformation(), and ClasspReceiveWriteUsingTokenInformation().

◆ SrbGetDataBuffer()

FORCEINLINE PVOID SrbGetDataBuffer ( _In_ PVOID  Srb)

Definition at line 728 of file srbhelper.h.

730 {
732  PVOID DataBuffer;
733 
734  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
735  {
736  DataBuffer = srb->DataBuffer;
737  }
738  else
739  {
740  DataBuffer = ((PSCSI_REQUEST_BLOCK)srb)->DataBuffer;
741  }
742  return DataBuffer;
743 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by RetryRequest(), and SubmitTransferPacket().

◆ SrbGetDataTransferLength()

FORCEINLINE ULONG SrbGetDataTransferLength ( _In_ PVOID  Srb)

Definition at line 765 of file srbhelper.h.

767 {
769  ULONG DataTransferLength;
770 
771  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
772  {
773  DataTransferLength = srb->DataTransferLength;
774  }
775  else
776  {
777  DataTransferLength = ((PSCSI_REQUEST_BLOCK)srb)->DataTransferLength;
778  }
779  return DataTransferLength;
780 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClassGetLBProvisioningLogPage(), ClassInterpretSenseInfo(), ClasspBuildRequestEx(), ClasspDeviceGetBlockDeviceCharacteristicsVPDPage(), ClasspDeviceGetBlockLimitsVPDPage(), ClasspDeviceGetLBProvisioningVPDPage(), ClasspGetBlockDeviceTokenLimitsInfo(), ClasspGetInquiryVpdSupportInfo(), ClassReadCapacity16(), GetLBAStatus(), RetryRequest(), SubmitTransferPacket(), and TransferPktComplete().

◆ SrbGetDefaultSrbLengthFromFunction()

FORCEINLINE ULONG SrbGetDefaultSrbLengthFromFunction ( _In_ ULONG  SrbFunction)

Definition at line 246 of file srbhelper.h.

248 {
249  switch (SrbFunction)
250  {
251  case SRB_FUNCTION_PNP:
254  case SRB_FUNCTION_POWER:
257  case SRB_FUNCTION_WMI:
265  default:
267  }
268 }
struct SRB_ALIGN _SRBEX_DATA_WMI SRBEX_DATA_WMI
struct SRB_ALIGN _SRBEX_DATA_POWER SRBEX_DATA_POWER
struct SRB_ALIGN _SRBEX_DATA_PNP SRBEX_DATA_PNP
#define SRB_FUNCTION_POWER
Definition: srb.h:95
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 SRBEX_DATA_SCSI_CDB16
#define SRB_FUNCTION_WMI
Definition: srb.h:323
#define SRB_FUNCTION_IO_CONTROL
Definition: srb.h:309
#define SRB_ALIGN_SIZEOF(x)
Definition: srbhelper.h:16
#define SRB_FUNCTION_PNP
Definition: srb.h:96
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 STOR_ADDR_BTL8
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307

◆ SrbGetLun()

FORCEINLINE UCHAR SrbGetLun ( _In_ PVOID  Srb)

Definition at line 1217 of file srbhelper.h.

1219 {
1221  UCHAR Lun = 0;
1222  PSTOR_ADDRESS storAddr = NULL;
1223 
1224  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1225  {
1226  storAddr = (PSTOR_ADDRESS)SrbGetAddress(srb);
1227  if (storAddr)
1228  {
1229  switch (storAddr->Type)
1230  {
1232  Lun = ((PSTOR_ADDR_BTL8)storAddr)->Lun;
1233  break;
1234 
1235  default:
1237  break;
1238  }
1239  }
1240  }
1241  else
1242  {
1243  Lun = ((PSCSI_REQUEST_BLOCK)srb)->Lun;
1244  }
1245  return Lun;
1246 }
#define STOR_ADDRESS_TYPE_BTL8
Definition: scsi.h:3525
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1310
struct STOR_ADDRESS_ALIGN _STOR_ADDRESS * PSTOR_ADDRESS
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 * PSTOR_ADDR_BTL8
FORCEINLINE PSTOR_ADDRESS SrbGetAddress(_In_ PSTORAGE_REQUEST_BLOCK Srb)
Definition: srbhelper.h:139
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClassInterpretSenseInfo().

◆ SrbGetMiniportContext()

FORCEINLINE PVOID SrbGetMiniportContext ( _In_ PVOID  Srb)

Definition at line 1313 of file srbhelper.h.

1315 {
1317 
1318  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1319  {
1320  return srb->MiniportContext;
1321  }
1322  else
1323  {
1324  return ((PSCSI_REQUEST_BLOCK)srb)->SrbExtension;
1325  }
1326 }
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetNextSrb()

FORCEINLINE PVOID SrbGetNextSrb ( _In_ PVOID  Srb)

Definition at line 892 of file srbhelper.h.

894 {
896 
897  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
898  {
899  return (PVOID)srb->NextSrb;
900  }
901  else
902  {
903  return (PVOID)((PSCSI_REQUEST_BLOCK)srb)->NextSrb;
904  }
905 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetOriginalRequest()

FORCEINLINE PVOID SrbGetOriginalRequest ( _In_ PVOID  Srb)

Definition at line 693 of file srbhelper.h.

695 {
697 
698  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
699  {
700  return srb->OriginalRequest;
701  }
702  else
703  {
704  return ((PSCSI_REQUEST_BLOCK)srb)->OriginalRequest;
705  }
706 }
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN _In_opt_ WDFREQUEST OriginalRequest
Definition: cdrom.h:989
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetPathId()

FORCEINLINE UCHAR SrbGetPathId ( _In_ PVOID  Srb)

Definition at line 1151 of file srbhelper.h.

1153 {
1155  UCHAR PathId = 0;
1156  PSTOR_ADDRESS storAddr = NULL;
1157 
1158  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1159  {
1160  storAddr = (PSTOR_ADDRESS)SrbGetAddress(srb);
1161  if (storAddr)
1162  {
1163  switch (storAddr->Type)
1164  {
1166  PathId = ((PSTOR_ADDR_BTL8)storAddr)->Path;
1167  break;
1168 
1169  default:
1171  break;
1172  }
1173  }
1174  }
1175  else
1176  {
1177  PathId = ((PSCSI_REQUEST_BLOCK)srb)->PathId;
1178  }
1179  return PathId;
1180 }
#define STOR_ADDRESS_TYPE_BTL8
Definition: scsi.h:3525
struct STOR_ADDRESS_ALIGN _STOR_ADDRESS * PSTOR_ADDRESS
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 * PSTOR_ADDR_BTL8
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1310
FORCEINLINE PSTOR_ADDRESS SrbGetAddress(_In_ PSTORAGE_REQUEST_BLOCK Srb)
Definition: srbhelper.h:139
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClassInterpretSenseInfo().

◆ SrbGetPathTargetLun()

FORCEINLINE VOID SrbGetPathTargetLun ( _In_ PVOID  Srb,
_In_opt_ PUCHAR  PathId,
_In_opt_ PUCHAR  TargetId,
_In_opt_ PUCHAR  Lun 
)

Definition at line 1250 of file srbhelper.h.

1255 {
1257  PSTOR_ADDRESS storAddr = NULL;
1258 
1259  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1260  {
1261  storAddr = (PSTOR_ADDRESS)SrbGetAddress(srb);
1262  if (storAddr)
1263  {
1264  switch (storAddr->Type)
1265  {
1267  if (PathId != NULL)
1268  {
1269  *PathId = ((PSTOR_ADDR_BTL8)storAddr)->Path;
1270  }
1271 
1272  if (TargetId != NULL)
1273  {
1274  *TargetId = ((PSTOR_ADDR_BTL8)storAddr)->Target;
1275  }
1276 
1277  if (Lun != NULL)
1278  {
1279  *Lun = ((PSTOR_ADDR_BTL8)storAddr)->Lun;
1280  }
1281 
1282  break;
1283 
1284  default:
1286  break;
1287  }
1288  }
1289  }
1290  else
1291  {
1292  if (PathId != NULL)
1293  {
1294  *PathId = ((PSCSI_REQUEST_BLOCK)srb)->PathId;
1295  }
1296 
1297  if (TargetId != NULL)
1298  {
1299  *TargetId = ((PSCSI_REQUEST_BLOCK)srb)->TargetId;
1300  }
1301 
1302  if (Lun != NULL)
1303  {
1304  *Lun = ((PSCSI_REQUEST_BLOCK)srb)->Lun;
1305  }
1306  }
1307 
1308  return;
1309 }
#define STOR_ADDRESS_TYPE_BTL8
Definition: scsi.h:3525
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1310
struct STOR_ADDRESS_ALIGN _STOR_ADDRESS * PSTOR_ADDRESS
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 * PSTOR_ADDR_BTL8
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1310
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1310
FORCEINLINE PSTOR_ADDRESS SrbGetAddress(_In_ PSTORAGE_REQUEST_BLOCK Srb)
Definition: srbhelper.h:139
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetPortContext()

FORCEINLINE PVOID SrbGetPortContext ( _In_ PVOID  Srb)

Definition at line 1379 of file srbhelper.h.

1381 {
1383 
1384  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1385  {
1386  return srb->PortContext;
1387  }
1388  else
1389  {
1391  return NULL;
1392  }
1393 }
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetPrimarySrbExData()

FORCEINLINE PSRBEX_DATA SrbGetPrimarySrbExData ( _In_ PSTORAGE_REQUEST_BLOCK  Srb)

Definition at line 94 of file srbhelper.h.

96 {
97  if (Srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
98  {
99  switch (Srb->SrbFunction)
100  {
101  case SRB_FUNCTION_POWER:
103 
104  case SRB_FUNCTION_PNP:
106 
107  case SRB_FUNCTION_WMI:
109 
111  PSRBEX_DATA srbExData = NULL;
112  UCHAR i = 0;
113 
114  for (i = 0; i < Srb->NumSrbExData; i++)
115  {
116  if (Srb->SrbExDataOffset[i] >= sizeof(STORAGE_REQUEST_BLOCK) &&
117  Srb->SrbExDataOffset[i] < Srb->SrbLength)
118  {
119  srbExData = (PSRBEX_DATA)((PUCHAR)Srb + Srb->SrbExDataOffset[i]);
120  if (srbExData->Type == SrbExDataTypeScsiCdb16 ||
121  srbExData->Type == SrbExDataTypeScsiCdb32 ||
122  srbExData->Type == SrbExDataTypeScsiCdbVar)
123  {
124  return srbExData;
125  }
126  }
127  }
128  return NULL;
129  }
130 
131  default:
132  return NULL;
133  }
134  }
135 
136  return NULL;
137 }
FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByType(_In_ PSTORAGE_REQUEST_BLOCK Srb, _In_ SRBEXDATATYPE Type)
Definition: srbhelper.h:66
struct SRB_ALIGN _SRBEX_DATA * PSRBEX_DATA
unsigned char * PUCHAR
Definition: retypes.h:3
#define SRB_FUNCTION_POWER
Definition: srb.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define SRB_FUNCTION_WMI
Definition: srb.h:323
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
#define SRB_FUNCTION_PNP
Definition: srb.h:96
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetQueueTag()

FORCEINLINE ULONG SrbGetQueueTag ( _In_ PVOID  Srb)

Definition at line 873 of file srbhelper.h.

875 {
877 
878  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
879  {
880  return srb->RequestTag;
881  }
882  else
883  {
884  return ((PSCSI_REQUEST_BLOCK)srb)->QueueTag;
885  }
886 }
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetRequestAttribute()

FORCEINLINE ULONG SrbGetRequestAttribute ( _In_ PVOID  Srb)

Definition at line 1111 of file srbhelper.h.

1113 {
1115  ULONG RequestAttribute;
1116  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1117  {
1118  RequestAttribute = srb->RequestAttribute;
1119  }
1120  else
1121  {
1122  RequestAttribute = ((PSCSI_REQUEST_BLOCK)srb)->QueueAction;
1123  }
1124  return RequestAttribute;
1125 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _Success_().

◆ SrbGetScsiData()

FORCEINLINE PCDB SrbGetScsiData ( _In_ PSTORAGE_REQUEST_BLOCK  SrbEx,
_In_opt_ PUCHAR  CdbLength8,
_In_opt_ PULONG  CdbLength32,
_In_opt_ PUCHAR  ScsiStatus,
_In_opt_ PVOID SenseInfoBuffer,
_In_opt_ PUCHAR  SenseInfoBufferLength 
)

Definition at line 272 of file srbhelper.h.

279 {
280  PCDB Cdb = NULL;
281  ULONG i;
282  PSRBEX_DATA SrbExData = NULL;
283  BOOLEAN FoundEntry = FALSE;
284 
285  if ((SrbEx->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK) &&
286  (SrbEx->SrbFunction == SRB_FUNCTION_EXECUTE_SCSI))
287  {
288  SRBHELPER_ASSERT(SrbEx->NumSrbExData > 0);
289 
290  for (i = 0; i < SrbEx->NumSrbExData; i++)
291  {
292  if ((SrbEx->SrbExDataOffset[i] < sizeof(STORAGE_REQUEST_BLOCK)) ||
293  (SrbEx->SrbExDataOffset[i] >= SrbEx->SrbLength))
294  {
296  continue;
297  }
298 
299  SrbExData = (PSRBEX_DATA)((PUCHAR)SrbEx + SrbEx->SrbExDataOffset[i]);
300 
301  switch (SrbExData->Type)
302  {
304  if (SrbEx->SrbExDataOffset[i] + sizeof(SRBEX_DATA_SCSI_CDB16) <= SrbEx->SrbLength)
305  {
306  FoundEntry = TRUE;
307  if (CdbLength8)
308  {
309  *CdbLength8 = ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->CdbLength;
310  }
311 
312  if (((PSRBEX_DATA_SCSI_CDB16)SrbExData)->CdbLength > 0)
313  {
314  Cdb = (PCDB)((PSRBEX_DATA_SCSI_CDB16)SrbExData)->Cdb;
315  }
316 
317  if (ScsiStatus)
318  {
319  *ScsiStatus = ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->ScsiStatus;
320  }
321 
322  if (SenseInfoBuffer)
323  {
324  *SenseInfoBuffer = ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->SenseInfoBuffer;
325  }
326 
328  {
329  *SenseInfoBufferLength = ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->SenseInfoBufferLength;
330  }
331  }
332  else
333  {
334  // Catch invalid offset
336  }
337  break;
338 
340  if (SrbEx->SrbExDataOffset[i] + sizeof(SRBEX_DATA_SCSI_CDB32) <= SrbEx->SrbLength)
341  {
342  FoundEntry = TRUE;
343  if (CdbLength8)
344  {
345  *CdbLength8 = ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->CdbLength;
346  }
347 
348  if (((PSRBEX_DATA_SCSI_CDB32)SrbExData)->CdbLength > 0)
349  {
350  Cdb = (PCDB)((PSRBEX_DATA_SCSI_CDB32)SrbExData)->Cdb;
351  }
352 
353  if (ScsiStatus)
354  {
355  *ScsiStatus = ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->ScsiStatus;
356  }
357 
358  if (SenseInfoBuffer)
359  {
360  *SenseInfoBuffer = ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->SenseInfoBuffer;
361  }
362 
364  {
365  *SenseInfoBufferLength = ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->SenseInfoBufferLength;
366  }
367  }
368  else
369  {
370  // Catch invalid offset
372  }
373  break;
374 
376  if (SrbEx->SrbExDataOffset[i] + sizeof(SRBEX_DATA_SCSI_CDB_VAR) <= SrbEx->SrbLength)
377  {
378  FoundEntry = TRUE;
379  if (CdbLength32)
380  {
381  *CdbLength32 = ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->CdbLength;
382  }
383 
384  if (((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->CdbLength > 0)
385  {
386  Cdb = (PCDB)((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->Cdb;
387  }
388 
389  if (ScsiStatus)
390  {
391  *ScsiStatus = ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->ScsiStatus;
392  }
393 
394  if (SenseInfoBuffer)
395  {
396  *SenseInfoBuffer = ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->SenseInfoBuffer;
397  }
398 
400  {
401  *SenseInfoBufferLength = ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->SenseInfoBufferLength;
402  }
403  }
404  else
405  {
407  }
408  break;
409  }
410 
411  if (FoundEntry)
412  {
413  break;
414  }
415  }
416  }
417  else
418  {
419 
420  if (CdbLength8)
421  {
422  *CdbLength8 = 0;
423  }
424 
425  if (CdbLength32)
426  {
427  *CdbLength32 = 0;
428  }
429 
430  if (ScsiStatus)
431  {
432  *ScsiStatus = SCSISTAT_GOOD;
433  }
434 
435  if (SenseInfoBuffer)
436  {
437  *SenseInfoBuffer = NULL;
438  }
439 
441  {
443  }
444  }
445 
446  return Cdb;
447 }
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 SRBEX_DATA_SCSI_CDB32
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR SRBEX_DATA_SCSI_CDB_VAR
#define TRUE
Definition: types.h:120
struct SRB_ALIGN _SRBEX_DATA * PSRBEX_DATA
unsigned char * PUCHAR
Definition: retypes.h:3
Definition: cdrw_hw.h:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 SRBEX_DATA_SCSI_CDB16
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 * PSRBEX_DATA_SCSI_CDB16
smooth NULL
Definition: ftsmooth.c:416
union _CDB * PCDB
_In_ UCHAR SenseInfoBufferLength
Definition: scsi.h:3705
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
Definition: scratch.h:156
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 * PSRBEX_DATA_SCSI_CDB32
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR * PSRBEX_DATA_SCSI_CDB_VAR
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
unsigned int ULONG
Definition: retypes.h:1
#define SCSISTAT_GOOD
Definition: cdrw_hw.h:1078

Referenced by SrbGetCdb(), SrbGetCdbLength(), SrbGetScsiStatus(), SrbGetSenseInfoBuffer(), and SrbGetSenseInfoBufferLength().

◆ SrbGetScsiStatus()

FORCEINLINE UCHAR SrbGetScsiStatus ( _In_ PVOID  Srb)

Definition at line 1037 of file srbhelper.h.

1039 {
1041  UCHAR scsiStatus = 0;
1042 
1043  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1044  {
1045  SrbGetScsiData(srb, NULL, NULL, &scsiStatus, NULL, NULL);
1046  }
1047  else
1048  {
1049  scsiStatus = ((PSCSI_REQUEST_BLOCK)srb)->ScsiStatus;
1050  }
1051  return scsiStatus;
1052 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
FORCEINLINE PCDB SrbGetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:272

Referenced by ClassInterpretSenseInfo().

◆ SrbGetSenseInfoBuffer()

FORCEINLINE PVOID SrbGetSenseInfoBuffer ( _In_ PVOID  Srb)

Definition at line 619 of file srbhelper.h.

621 {
623  PVOID pSenseInfoBuffer = NULL;
624 
625  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
626  {
627  SrbGetScsiData(srb, NULL, NULL, NULL, &pSenseInfoBuffer, NULL);
628  }
629  else
630  {
631  pSenseInfoBuffer = ((PSCSI_REQUEST_BLOCK)srb)->SenseInfoBuffer;
632  }
633  return pSenseInfoBuffer;
634 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
FORCEINLINE PCDB SrbGetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:272

Referenced by ClassInterpretSenseInfo(), ClasspIsThinProvisioningError(), ClasspMediaChangeDetectionCompletion(), ClasspPowerDownCompletion(), ClasspTransferPacketGetSenseInfoBuffer(), DbgGetAdditionalSenseCodeQualifierStr(), DbgGetAdditionalSenseCodeStr(), DbgGetSenseCodeStr(), FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(), PORT_ALLOCATED_SENSE_EX(), TransferPacketRetryTimerDpc(), and TransferPktComplete().

◆ SrbGetSenseInfoBufferLength()

FORCEINLINE UCHAR SrbGetSenseInfoBufferLength ( _In_ PVOID  Srb)

Definition at line 638 of file srbhelper.h.

640 {
643 
644  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
645  {
647  }
648  else
649  {
650  SenseInfoBufferLength = ((PSCSI_REQUEST_BLOCK)srb)->SenseInfoBufferLength;
651  }
652  return SenseInfoBufferLength;
653 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
_In_ UCHAR SenseInfoBufferLength
Definition: scsi.h:3705
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
FORCEINLINE PCDB SrbGetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:272

Referenced by ClassInterpretSenseInfo(), ClasspIsThinProvisioningError(), ClasspMediaChangeDetectionCompletion(), ClasspPowerDownCompletion(), ClasspTransferPacketGetSenseInfoBufferLength(), ClassSendSrbSynchronous(), DbgGetAdditionalSenseCodeQualifierStr(), DbgGetAdditionalSenseCodeStr(), DbgGetSenseCodeStr(), InterpretTransferPacketError(), TransferPacketRetryTimerDpc(), and TransferPktComplete().

◆ SrbGetSrbExDataByIndex()

FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByIndex ( _In_ PSTORAGE_REQUEST_BLOCK  Srb,
_In_ ULONG  SrbExDataIndex 
)

Definition at line 47 of file srbhelper.h.

50 {
51  PSRBEX_DATA srbExData = NULL;
52 
53  if ((Srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK) &&
54  (SrbExDataIndex < Srb->NumSrbExData) && (Srb->SrbExDataOffset[SrbExDataIndex]) &&
55  (Srb->SrbExDataOffset[SrbExDataIndex] >= sizeof(STORAGE_REQUEST_BLOCK)) &&
56  (Srb->SrbExDataOffset[SrbExDataIndex] < Srb->SrbLength))
57  {
58  srbExData = (PSRBEX_DATA)((PUCHAR)Srb + Srb->SrbExDataOffset[SrbExDataIndex]);
59  }
60 
61  return srbExData;
62 }
struct SRB_ALIGN _SRBEX_DATA * PSRBEX_DATA
unsigned char * PUCHAR
Definition: retypes.h:3
smooth NULL
Definition: ftsmooth.c:416
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetSrbExDataByType()

FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByType ( _In_ PSTORAGE_REQUEST_BLOCK  Srb,
_In_ SRBEXDATATYPE  Type 
)

Definition at line 66 of file srbhelper.h.

69 {
70  if ((Srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK) && (Srb->NumSrbExData > 0))
71  {
72  PSRBEX_DATA srbExData = NULL;
73  UCHAR i = 0;
74 
75  for (i = 0; i < Srb->NumSrbExData; i++)
76  {
77  if (Srb->SrbExDataOffset[i] >= sizeof(STORAGE_REQUEST_BLOCK) &&
78  Srb->SrbExDataOffset[i] < Srb->SrbLength)
79  {
80  srbExData = (PSRBEX_DATA)((PUCHAR)Srb + Srb->SrbExDataOffset[i]);
81  if (srbExData->Type == Type)
82  {
83  return srbExData;
84  }
85  }
86  }
87  }
88 
89  return NULL;
90 }
Type
Definition: Type.h:6
struct SRB_ALIGN _SRBEX_DATA * PSRBEX_DATA
unsigned char * PUCHAR
Definition: retypes.h:3
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by SrbGetPrimarySrbExData().

◆ SrbGetSrbFlags()

FORCEINLINE ULONG SrbGetSrbFlags ( _In_ PVOID  Srb)

Definition at line 927 of file srbhelper.h.

929 {
931  ULONG srbFlags;
932 
933  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
934  {
935  srbFlags = srb->SrbFlags;
936  }
937  else
938  {
939  srbFlags = ((PSCSI_REQUEST_BLOCK)srb)->SrbFlags;
940  }
941  return srbFlags;
942 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _Success_(), ClassFreeOrReuseSrb(), ClassInterpretSenseInfo(), ClasspPowerDownCompletion(), ClasspPowerHandler(), ClasspPowerUpCompletion(), FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(), PORT_ALLOCATED_SENSE_EX(), RetryPowerRequest(), RetryRequest(), and TransferPktComplete().

◆ SrbGetSrbFunction()

FORCEINLINE ULONG SrbGetSrbFunction ( _In_ PVOID  Srb)

Definition at line 602 of file srbhelper.h.

604 {
606 
607  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
608  {
609  return srb->SrbFunction;
610  }
611  else
612  {
613  return (ULONG)((PSCSI_REQUEST_BLOCK)srb)->Function;
614  }
615 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetSrbLength()

FORCEINLINE ULONG SrbGetSrbLength ( _In_ PVOID  Srb)

Definition at line 215 of file srbhelper.h.

217 {
219 
220  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
221  {
222  return srb->SrbLength;
223  }
224  else
225  {
226  return sizeof(SCSI_REQUEST_BLOCK);
227  }
228 }
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetSrbStatus()

FORCEINLINE UCHAR SrbGetSrbStatus ( _In_ PVOID  Srb)

Definition at line 1330 of file srbhelper.h.

1332 {
1334 
1335  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1336  {
1337  return srb->SrbStatus;
1338  }
1339  else
1340  {
1341  return ((PSCSI_REQUEST_BLOCK)srb)->SrbStatus;
1342  }
1343 }
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbGetSystemStatus()

FORCEINLINE ULONG SrbGetSystemStatus ( _In_ PVOID  Srb)

Definition at line 1000 of file srbhelper.h.

1002 {
1004  ULONG systemStatus;
1005 
1006  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1007  {
1008  systemStatus = srb->SystemStatus;
1009  }
1010  else
1011  {
1012  systemStatus = ((PSCSI_REQUEST_BLOCK)srb)->InternalStatus;
1013  }
1014  return systemStatus;
1015 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClassInterpretSenseInfo().

◆ SrbGetTargetId()

FORCEINLINE UCHAR SrbGetTargetId ( _In_ PVOID  Srb)

Definition at line 1184 of file srbhelper.h.

1186 {
1188  UCHAR TargetId = 0;
1189  PSTOR_ADDRESS storAddr = NULL;
1190 
1191  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1192  {
1193  storAddr = (PSTOR_ADDRESS)SrbGetAddress(srb);
1194  if (storAddr)
1195  {
1196  switch (storAddr->Type)
1197  {
1199  TargetId = ((PSTOR_ADDR_BTL8)storAddr)->Target;
1200  break;
1201 
1202  default:
1204  break;
1205  }
1206  }
1207  }
1208  else
1209  {
1210  TargetId = ((PSCSI_REQUEST_BLOCK)srb)->TargetId;
1211  }
1212  return TargetId;
1213 }
#define STOR_ADDRESS_TYPE_BTL8
Definition: scsi.h:3525
struct STOR_ADDRESS_ALIGN _STOR_ADDRESS * PSTOR_ADDRESS
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 * PSTOR_ADDR_BTL8
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1310
FORCEINLINE PSTOR_ADDRESS SrbGetAddress(_In_ PSTORAGE_REQUEST_BLOCK Srb)
Definition: srbhelper.h:139
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClassInterpretSenseInfo().

◆ SrbGetTimeOutValue()

FORCEINLINE ULONG SrbGetTimeOutValue ( _In_ PVOID  Srb)

Definition at line 802 of file srbhelper.h.

804 {
806  ULONG timeOutValue;
807 
808  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
809  {
810  timeOutValue = srb->TimeOutValue;
811  }
812  else
813  {
814  timeOutValue = ((PSCSI_REQUEST_BLOCK)srb)->TimeOutValue;
815  }
816  return timeOutValue;
817 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbSetCdbLength()

FORCEINLINE VOID SrbSetCdbLength ( _In_ PVOID  Srb,
_In_ UCHAR  CdbLength 
)

Definition at line 1093 of file srbhelper.h.

1096 {
1098 
1099  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1100  {
1101  SrbSetScsiData(srb, &CdbLength, NULL, NULL, NULL, NULL);
1102  }
1103  else
1104  {
1105  ((PSCSI_REQUEST_BLOCK)srb)->CdbLength = CdbLength;
1106  }
1107 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
FORCEINLINE VOID SrbSetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:451
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _IRQL_requires_max_(), ClassDeviceControl(), ClassDeviceHwFirmwareActivateProcess(), ClassDeviceHwFirmwareDownloadProcess(), ClassGetLBProvisioningLogPage(), ClassInterpretSenseInfo(), ClasspBuildRequestEx(), ClasspCleanupProtectedLocks(), ClasspDeviceGetBlockDeviceCharacteristicsVPDPage(), ClasspDeviceGetBlockLimitsVPDPage(), ClasspDeviceGetLBProvisioningVPDPage(), ClasspEjectionControl(), ClasspGetBlockDeviceTokenLimitsInfo(), ClasspGetInquiryVpdSupportInfo(), ClasspInterpretGesnData(), ClasspPersistentReserve(), ClasspPowerDownCompletion(), ClasspPowerUpCompletion(), ClasspPrepareMcnIrp(), ClasspWriteCacheProperty(), ClassReadCapacity16(), ClassSendStartUnit(), DeviceProcessDsmTrimRequest(), GetLBAStatus(), InitializeTransferPackets(), SetupDriveCapacityTransferPacket(), SetupEjectionTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), and SetupReadWriteTransferPacket().

◆ SrbSetDataBuffer()

FORCEINLINE VOID SrbSetDataBuffer ( _In_ PVOID  Srb,
_In_opt_ __drv_aliasesMem PVOID  DataBuffer 
)

Definition at line 747 of file srbhelper.h.

750 {
752 
753  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
754  {
755  srb->DataBuffer = DataBuffer;
756  }
757  else
758  {
759  ((PSCSI_REQUEST_BLOCK)srb)->DataBuffer = DataBuffer;
760  }
761 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _IRQL_requires_max_(), _Success_(), ClasspBuildRequestEx(), ClassSendSrbSynchronous(), RetryTransferPacket(), SetupDriveCapacityTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), and SetupReadWriteTransferPacket().

◆ SrbSetDataTransferLength()

FORCEINLINE VOID SrbSetDataTransferLength ( _In_ PVOID  Srb,
_In_ ULONG  DataTransferLength 
)

Definition at line 784 of file srbhelper.h.

787 {
789 
790  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
791  {
792  srb->DataTransferLength = DataTransferLength;
793  }
794  else
795  {
796  ((PSCSI_REQUEST_BLOCK)srb)->DataTransferLength = DataTransferLength;
797  }
798 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _IRQL_requires_max_(), _Success_(), ClasspBuildRequestEx(), ClassSendSrbSynchronous(), RetryPowerRequest(), RetryRequest(), RetryTransferPacket(), SetupDriveCapacityTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), and SetupReadWriteTransferPacket().

◆ SrbSetNextSrb()

FORCEINLINE VOID SrbSetNextSrb ( _In_ PVOID  Srb,
_In_opt_ PVOID  NextSrb 
)

Definition at line 909 of file srbhelper.h.

912 {
914 
915  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
916  {
917  srb->NextSrb = (PSTORAGE_REQUEST_BLOCK)NextSrb;
918  }
919  else
920  {
921  ((PSCSI_REQUEST_BLOCK)srb)->NextSrb = (PSCSI_REQUEST_BLOCK)NextSrb;
922  }
923 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _Success_(), and ClassSendSrbSynchronous().

◆ SrbSetOriginalRequest()

FORCEINLINE VOID SrbSetOriginalRequest ( _In_ PVOID  Srb,
_In_opt_ PVOID  OriginalRequest 
)

Definition at line 710 of file srbhelper.h.

713 {
715 
716  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
717  {
718  srb->OriginalRequest = OriginalRequest;
719  }
720  else
721  {
723  }
724 }
PVOID OriginalRequest
Definition: srb.h:258
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN _In_opt_ WDFREQUEST OriginalRequest
Definition: cdrom.h:989
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _IRQL_requires_max_(), _Success_(), ClasspBuildRequestEx(), ClasspPowerDownCompletion(), ClasspPowerHandler(), ClasspPowerUpCompletion(), ClasspReleaseQueue(), ClassSendSrbSynchronous(), ClassSendStartUnit(), SetupDriveCapacityTransferPacket(), SetupEjectionTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), and SetupReadWriteTransferPacket().

◆ SrbSetPortContext()

FORCEINLINE VOID SrbSetPortContext ( _In_ PVOID  Srb,
_In_ PVOID  PortContext 
)

Definition at line 1397 of file srbhelper.h.

1400 {
1402 
1403  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1404  {
1405  srb->PortContext = PortContext;
1406  }
1407  else
1408  {
1410  }
1411 }
#define FALSE
Definition: types.h:117
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbSetQueueSortKey()

FORCEINLINE VOID SrbSetQueueSortKey ( _In_ PVOID  Srb,
_In_ ULONG  QueueSortKey 
)

Definition at line 839 of file srbhelper.h.

842 {
844 
845  if (srb->Function != SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
846  {
847  ((PSCSI_REQUEST_BLOCK)srb)->QueueSortKey = QueueSortKey;
848  }
849 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by ClasspBuildRequestEx(), and SetupReadWriteTransferPacket().

◆ SrbSetQueueTag()

FORCEINLINE VOID SrbSetQueueTag ( _In_ PVOID  Srb,
_In_ ULONG  QueueTag 
)

Definition at line 853 of file srbhelper.h.

856 {
858 
859  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
860  {
861  srb->RequestTag = QueueTag;
862  }
863  else
864  {
865  ((PSCSI_REQUEST_BLOCK)srb)->QueueTag = (UCHAR)QueueTag;
866  }
867 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by RetryRequest().

◆ SrbSetRequestAttribute()

◆ SrbSetScsiData()

FORCEINLINE VOID SrbSetScsiData ( _In_ PSTORAGE_REQUEST_BLOCK  SrbEx,
_In_opt_ PUCHAR  CdbLength8,
_In_opt_ PULONG  CdbLength32,
_In_opt_ PUCHAR  ScsiStatus,
_In_opt_ PVOID SenseInfoBuffer,
_In_opt_ PUCHAR  SenseInfoBufferLength 
)

Definition at line 451 of file srbhelper.h.

458 {
459  ULONG i;
460  PSRBEX_DATA SrbExData = NULL;
461  BOOLEAN FoundEntry = FALSE;
462 
463  if ((SrbEx->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK) &&
464  (SrbEx->SrbFunction == SRB_FUNCTION_EXECUTE_SCSI))
465  {
466  SRBHELPER_ASSERT(SrbEx->NumSrbExData > 0);
467 
468  for (i = 0; i < SrbEx->NumSrbExData; i++)
469  {
470  if ((SrbEx->SrbExDataOffset[i] < sizeof(STORAGE_REQUEST_BLOCK)) ||
471  (SrbEx->SrbExDataOffset[i] >= SrbEx->SrbLength))
472  {
474  continue;
475  }
476 
477  SrbExData = (PSRBEX_DATA)((PUCHAR)SrbEx + SrbEx->SrbExDataOffset[i]);
478 
479  switch (SrbExData->Type)
480  {
482  if (SrbEx->SrbExDataOffset[i] + sizeof(SRBEX_DATA_SCSI_CDB16) <= SrbEx->SrbLength)
483  {
484  FoundEntry = TRUE;
485  if (CdbLength8)
486  {
487  ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->CdbLength = *CdbLength8;
488  }
489 
490  if (ScsiStatus)
491  {
492  ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->ScsiStatus = *ScsiStatus;
493  }
494 
495  if (SenseInfoBuffer)
496  {
497  ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->SenseInfoBuffer = *SenseInfoBuffer;
498  }
499 
501  {
502  ((PSRBEX_DATA_SCSI_CDB16)SrbExData)->SenseInfoBufferLength = *SenseInfoBufferLength;
503  }
504  }
505  else
506  {
507  // Catch invalid offset
509  }
510  break;
511 
513  if (SrbEx->SrbExDataOffset[i] + sizeof(SRBEX_DATA_SCSI_CDB32) <= SrbEx->SrbLength)
514  {
515  FoundEntry = TRUE;
516  if (CdbLength8)
517  {
518  ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->CdbLength = *CdbLength8;
519  }
520 
521  if (ScsiStatus)
522  {
523  ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->ScsiStatus = *ScsiStatus;
524  }
525 
526  if (SenseInfoBuffer)
527  {
528  ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->SenseInfoBuffer = *SenseInfoBuffer;
529  }
530 
532  {
533  ((PSRBEX_DATA_SCSI_CDB32)SrbExData)->SenseInfoBufferLength = *SenseInfoBufferLength;
534  }
535  }
536  else
537  {
539  }
540  break;
541 
543  if (SrbEx->SrbExDataOffset[i] + sizeof(SRBEX_DATA_SCSI_CDB_VAR) <= SrbEx->SrbLength)
544  {
545  FoundEntry = TRUE;
546  if (CdbLength32)
547  {
548  ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->CdbLength = *CdbLength32;
549  }
550 
551  if (ScsiStatus)
552  {
553  ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->ScsiStatus = *ScsiStatus;
554  }
555 
556  if (SenseInfoBuffer)
557  {
558  ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->SenseInfoBuffer = *SenseInfoBuffer;
559  }
560 
562  {
563  ((PSRBEX_DATA_SCSI_CDB_VAR)SrbExData)->SenseInfoBufferLength = *SenseInfoBufferLength;
564  }
565  }
566  else
567  {
569  }
570  break;
571  }
572 
573  if (FoundEntry)
574  {
575  break;
576  }
577  }
578  }
579 }
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 SRBEX_DATA_SCSI_CDB32
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR SRBEX_DATA_SCSI_CDB_VAR
#define TRUE
Definition: types.h:120
struct SRB_ALIGN _SRBEX_DATA * PSRBEX_DATA
unsigned char * PUCHAR
Definition: retypes.h:3
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 SRBEX_DATA_SCSI_CDB16
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 * PSRBEX_DATA_SCSI_CDB16
smooth NULL
Definition: ftsmooth.c:416
_In_ UCHAR SenseInfoBufferLength
Definition: scsi.h:3705
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 * PSRBEX_DATA_SCSI_CDB32
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR * PSRBEX_DATA_SCSI_CDB_VAR
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
unsigned int ULONG
Definition: retypes.h:1

Referenced by SrbSetCdbLength(), SrbSetScsiStatus(), SrbSetSenseInfoBuffer(), and SrbSetSenseInfoBufferLength().

◆ SrbSetScsiStatus()

FORCEINLINE VOID SrbSetScsiStatus ( _In_ PVOID  Srb,
_In_ UCHAR  ScsiStatus 
)

Definition at line 1056 of file srbhelper.h.

1059 {
1061 
1062  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1063  {
1064  SrbSetScsiData(srb, NULL, NULL, &ScsiStatus, NULL, NULL);
1065  }
1066  else
1067  {
1068  ((PSCSI_REQUEST_BLOCK)srb)->ScsiStatus = ScsiStatus;
1069  }
1070 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
FORCEINLINE VOID SrbSetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:451
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _Success_(), ClasspPrepareMcnIrp(), ClasspReceivePopulateTokenInformationTransferPacketDone(), ClasspReceiveWriteUsingTokenInformationTransferPacketDone(), ClassSendSrbSynchronous(), RetryPowerRequest(), RetryRequest(), and SubmitTransferPacket().

◆ SrbSetSenseInfoBuffer()

FORCEINLINE VOID SrbSetSenseInfoBuffer ( _In_ PVOID  Srb,
_In_opt_ PVOID  SenseInfoBuffer 
)

Definition at line 657 of file srbhelper.h.

660 {
662 
663  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
664  {
665  SrbSetScsiData(srb, NULL, NULL, NULL, &SenseInfoBuffer, NULL);
666  }
667  else
668  {
669  ((PSCSI_REQUEST_BLOCK)srb)->SenseInfoBuffer = SenseInfoBuffer;
670  }
671 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
FORCEINLINE VOID SrbSetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:451
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _IRQL_requires_max_(), _Success_(), ClasspBuildRequestEx(), ClasspInterpretGesnData(), ClasspPowerDownCompletion(), ClasspPowerUpCompletion(), ClasspPrepareMcnIrp(), ClasspReceivePopulateTokenInformationTransferPacketDone(), ClasspReceiveWriteUsingTokenInformationTransferPacketDone(), ClassSendSrbSynchronous(), FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(), SetupDriveCapacityTransferPacket(), SetupEjectionTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), SetupReadWriteTransferPacket(), TransferPacketRetryTimerDpc(), and TransferPktComplete().

◆ SrbSetSenseInfoBufferLength()

FORCEINLINE VOID SrbSetSenseInfoBufferLength ( _In_ PVOID  Srb,
_In_ UCHAR  SenseInfoBufferLength 
)

Definition at line 675 of file srbhelper.h.

678 {
680 
681  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
682  {
684  }
685  else
686  {
687  ((PSCSI_REQUEST_BLOCK)srb)->SenseInfoBufferLength = SenseInfoBufferLength;
688  }
689 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
FORCEINLINE VOID SrbSetScsiData(_In_ PSTORAGE_REQUEST_BLOCK SrbEx, _In_opt_ PUCHAR CdbLength8, _In_opt_ PULONG CdbLength32, _In_opt_ PUCHAR ScsiStatus, _In_opt_ PVOID *SenseInfoBuffer, _In_opt_ PUCHAR SenseInfoBufferLength)
Definition: srbhelper.h:451
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
_In_ UCHAR SenseInfoBufferLength
Definition: scsi.h:3705
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _IRQL_requires_max_(), _Success_(), ClasspBuildRequestEx(), ClasspInterpretGesnData(), ClasspPowerDownCompletion(), ClasspPowerUpCompletion(), ClasspPrepareMcnIrp(), ClasspReceivePopulateTokenInformationTransferPacketDone(), ClasspReceiveWriteUsingTokenInformationTransferPacketDone(), ClassSendSrbSynchronous(), FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(), InitializeTransferPackets(), SetupDriveCapacityTransferPacket(), SetupEjectionTransferPacket(), SetupModeSelectTransferPacket(), SetupModeSenseTransferPacket(), SubmitTransferPacket(), TransferPacketRetryTimerDpc(), and TransferPktComplete().

◆ SrbSetSrbFlags()

FORCEINLINE VOID SrbSetSrbFlags ( _In_ PVOID  Srb,
_In_ ULONG  Flags 
)

Definition at line 964 of file srbhelper.h.

967 {
969 
970  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
971  {
972  srb->SrbFlags |= Flags;
973  }
974  else
975  {
976  ((PSCSI_REQUEST_BLOCK)srb)->SrbFlags |= Flags;
977  }
978 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

Referenced by _Success_(), ClassDeviceControl(), ClassDeviceHwFirmwareDownloadProcess(), ClasspBuildRequestEx(), ClasspPersistentReserve(), ClasspPowerHandler(), ClasspPowerUpCompletion(), ClassSendSrbSynchronous(), DeviceProcessDsmTrimRequest(), RetryRequest(), RetryTransferPacket(), and SetupReadWriteTransferPacket().

◆ SrbSetSrbLength()

FORCEINLINE VOID SrbSetSrbLength ( _In_ PVOID  Srb,
_In_ ULONG  Length 
)

Definition at line 232 of file srbhelper.h.

235 {
237 
238  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
239  {
240  srb->SrbLength = Length;
241  }
242 }
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbSetSrbStatus()

FORCEINLINE VOID SrbSetSrbStatus ( _In_ PVOID  Srb,
_In_ UCHAR  status 
)

Definition at line 1347 of file srbhelper.h.

1350 {
1352 
1353  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1354  {
1355  if (srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID)
1356  {
1357  srb->SrbStatus = status | SRB_STATUS_AUTOSENSE_VALID;
1358  }
1359  else
1360  {
1361  srb->SrbStatus = status;
1362  }
1363  }
1364  else
1365  {
1366  if (((PSCSI_REQUEST_BLOCK)srb)->SrbStatus & SRB_STATUS_AUTOSENSE_VALID)
1367  {
1369  }
1370  else
1371  {
1372  ((PSCSI_REQUEST_BLOCK)srb)->SrbStatus = status;
1373  }
1374  }
1375 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
#define SRB_STATUS_AUTOSENSE_VALID
Definition: srb.h:379
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ SrbSetSystemStatus()

FORCEINLINE VOID SrbSetSystemStatus ( _In_ PVOID  Srb,
_In_ ULONG  Status 
)

Definition at line 1019 of file srbhelper.h.

1022 {
1024 
1025  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1026  {
1027  srb->SystemStatus = Status;
1028  }
1029  else
1030  {
1031  ((PSCSI_REQUEST_BLOCK)srb)->InternalStatus = Status;
1032  }
1033 }
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
Status
Definition: gdiplustypes.h:24
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49

◆ SrbSetTimeOutValue()

FORCEINLINE VOID SrbSetTimeOutValue ( _In_ PVOID  Srb,
_In_ ULONG  TimeOutValue 
)

◆ SrbZeroSrb()

FORCEINLINE VOID SrbZeroSrb ( _In_ PVOID  Srb)

Definition at line 189 of file srbhelper.h.

191 {
193  UCHAR function = srb->Function;
194  USHORT length = srb->Length;
195 
196  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
197  {
198  ULONG srbLength = srb->SrbLength;
199 
200  SrbZeroMemory(Srb, srb->SrbLength);
201 
202  srb->SrbLength = srbLength;
203  }
204  else
205  {
207  }
208 
209  srb->Function = function;
210  srb->Length = length;
211 }
#define SrbZeroMemory(Destination, Length)
Definition: srbhelper.h:36
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49