ReactOS  0.4.15-dev-1207-g698a8e6
srbhelper.h
Go to the documentation of this file.
1 #ifndef _SRBHELPER_H_
2 #define _SRBHELPER_H_
3 
4 #if !defined(_NTSTORPORT_) && !defined(_NTSTORPORTP_) && !defined(_NTSRB_)
5 #include <scsi.h>
6 #include <srb.h>
7 #endif
8 
9 #if (NTDDI_VERSION >= NTDDI_WIN8)
10 
11 #if !defined(SRBHELPER_ASSERT)
12 #define SRBHELPER_ASSERT NT_ASSERT
13 #endif
14 
15 #if !defined(SRB_ALIGN_SIZEOF)
16 #define SRB_ALIGN_SIZEOF(x) (((ULONG_PTR)(sizeof(x) + sizeof(PVOID) - 1)) & ~(sizeof(PVOID) - 1))
17 #endif
18 
19 #if defined(_NTSTORPORT_) || defined(_NTSTORPORTP_)
20 #define SrbMoveMemory(Destination, Source, Length) StorPortMoveMemory(Destination, Source, Length)
21 #elif defined(_NTDDK_)
22 #define SrbMoveMemory(Destination, Source, Length) RtlMoveMemory(Destination, Source, Length)
23 #else
24 #define SrbMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length)
25 #endif
26 
27 #if defined(_NTDDK_)
28 #define SrbCopyMemory(Destination, Source, Length) RtlCopyMemory(Destination, Source, Length)
29 #else
30 #define SrbCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length)
31 #endif
32 
33 #if defined(_NTDDK_)
34 #define SrbZeroMemory(Destination, Length) RtlZeroMemory(Destination, Length)
35 #else
36 #define SrbZeroMemory(Destination, Length) memset(Destination, 0, Length)
37 #endif
38 
39 #if defined(_NTDDK_)
40 #define SrbEqualMemory(Source1, Source2, Length) RtlEqualMemory(Source1, Source2, Length)
41 #else
42 #define SrbEqualMemory(Source1, Source2, Length) (memcmp(Source1, Source2, Length) == 0)
43 #endif
44 
49  _In_ ULONG SrbExDataIndex)
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 }
63 
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 }
91 
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 }
138 
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 }
156 
158 BOOLEAN
160  _In_ PVOID DestinationSrb,
161  _In_ ULONG DestinationSrbLength,
162  _In_ PVOID SourceSrb)
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 }
186 
188 VOID
190  _In_ PVOID Srb)
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 }
212 
214 ULONG
216  _In_ PVOID Srb)
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 }
229 
231 VOID
233  _In_ PVOID Srb,
234  _In_ ULONG Length)
235 {
237 
238  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
239  {
240  srb->SrbLength = Length;
241  }
242 }
243 
245 ULONG
247  _In_ ULONG SrbFunction)
248 {
249  switch (SrbFunction)
250  {
251  case SRB_FUNCTION_PNP:
254  case SRB_FUNCTION_POWER:
257  case SRB_FUNCTION_WMI:
265  default:
267  }
268 }
269 
271 PCDB
274  _In_opt_ PUCHAR CdbLength8,
275  _In_opt_ PULONG CdbLength32,
276  _In_opt_ PUCHAR ScsiStatus,
277  _In_opt_ PVOID *SenseInfoBuffer,
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 }
448 
450 VOID
453  _In_opt_ PUCHAR CdbLength8,
454  _In_opt_ PULONG CdbLength32,
455  _In_opt_ PUCHAR ScsiStatus,
456  _In_opt_ PVOID *SenseInfoBuffer,
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 }
580 
582 PCDB
584  _In_ PVOID Srb)
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 }
599 
601 ULONG
603  _In_ PVOID Srb)
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 }
616 
618 PVOID
620  _In_ PVOID Srb)
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 }
635 
637 UCHAR
639  _In_ PVOID Srb)
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 }
654 
656 VOID
658  _In_ PVOID Srb,
659  _In_opt_ PVOID SenseInfoBuffer)
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 }
672 
674 VOID
676  _In_ PVOID Srb,
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 }
690 
692 PVOID
694  _In_ PVOID Srb)
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 }
707 
709 VOID
711  _In_ PVOID Srb,
713 {
715 
716  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
717  {
718  srb->OriginalRequest = OriginalRequest;
719  }
720  else
721  {
723  }
724 }
725 
727 PVOID
729  _In_ PVOID Srb)
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 }
744 
746 VOID
748  _In_ PVOID Srb,
749  _In_opt_ __drv_aliasesMem PVOID DataBuffer)
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 }
762 
764 ULONG
766  _In_ PVOID Srb)
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 }
781 
783 VOID
785  _In_ PVOID Srb,
786  _In_ ULONG DataTransferLength)
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 }
799 
801 ULONG
803  _In_ PVOID Srb)
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 }
818 
820 VOID
822  _In_ PVOID Srb,
823  _In_ ULONG TimeOutValue)
824 {
826 
827  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
828  {
829  srb->TimeOutValue = TimeOutValue;
830  }
831  else
832  {
833  ((PSCSI_REQUEST_BLOCK)srb)->TimeOutValue = TimeOutValue;
834  }
835 }
836 
838 VOID
840  _In_ PVOID Srb,
841  _In_ ULONG QueueSortKey)
842 {
844 
845  if (srb->Function != SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
846  {
847  ((PSCSI_REQUEST_BLOCK)srb)->QueueSortKey = QueueSortKey;
848  }
849 }
850 
852 VOID
854  _In_ PVOID Srb,
855  _In_ ULONG QueueTag)
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 }
868 
869 #define SrbSetRequestTag SrbSetQueueTag
870 
872 ULONG
874  _In_ PVOID Srb)
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 }
887 
888 #define SrbGetRequestTag SrbGetQueueTag
889 
891 PVOID
893  _In_ PVOID Srb)
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 }
906 
908 VOID
910  _In_ PVOID Srb,
911  _In_opt_ PVOID NextSrb)
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 }
924 
926 ULONG
928  _In_ PVOID Srb)
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 }
943 
945 VOID
947  _In_ PVOID Srb,
948  _In_ ULONG Flags)
949 {
951 
952  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
953  {
954  srb->SrbFlags = Flags;
955  }
956  else
957  {
958  ((PSCSI_REQUEST_BLOCK)srb)->SrbFlags = Flags;
959  }
960 }
961 
963 VOID
965  _In_ PVOID Srb,
966  _In_ ULONG Flags)
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 }
979 
981 VOID
983  _In_ PVOID Srb,
984  _In_ ULONG Flags)
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 }
997 
999 ULONG
1001  _In_ PVOID Srb)
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 }
1016 
1018 VOID
1020  _In_ PVOID Srb,
1021  _In_ ULONG Status)
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 }
1034 
1036 UCHAR
1038  _In_ PVOID Srb)
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 }
1053 
1055 VOID
1057  _In_ PVOID Srb,
1058  _In_ UCHAR ScsiStatus)
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 }
1071 
1073 UCHAR
1075  _In_ PVOID Srb)
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 }
1090 
1092 VOID
1094  _In_ PVOID Srb,
1095  _In_ UCHAR CdbLength)
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 }
1108 
1110 ULONG
1112  _In_ PVOID Srb)
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 }
1126 
1127 #define SrbGetQueueAction SrbGetRequestAttribute
1128 
1130 VOID
1132  _In_ PVOID Srb,
1133  _In_ UCHAR RequestAttribute)
1134 {
1136 
1137  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1138  {
1139  srb->RequestAttribute = RequestAttribute;
1140  }
1141  else
1142  {
1143  ((PSCSI_REQUEST_BLOCK)srb)->QueueAction = RequestAttribute;
1144  }
1145 }
1146 
1147 #define SrbSetQueueAction SrbSetRequestAttribute
1148 
1150 UCHAR
1152  _In_ PVOID Srb)
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 }
1181 
1183 UCHAR
1185  _In_ PVOID Srb)
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 }
1214 
1216 UCHAR
1218  _In_ PVOID Srb)
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 }
1247 
1249 VOID
1251  _In_ PVOID Srb,
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 }
1310 
1312 PVOID
1314  _In_ PVOID Srb)
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 }
1327 
1329 UCHAR
1331  _In_ PVOID Srb)
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 }
1344 
1346 VOID
1348  _In_ PVOID Srb,
1349  _In_ UCHAR status)
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 }
1376 
1378 PVOID
1380  _In_ PVOID Srb)
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 }
1394 
1396 VOID
1398  _In_ PVOID Srb,
1399  _In_ PVOID PortContext)
1400 {
1402 
1403  if (srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK)
1404  {
1405  srb->PortContext = PortContext;
1406  }
1407  else
1408  {
1410  }
1411 }
1412 
1413 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
1414 #endif /* _SRBHELPER_H_ */
FORCEINLINE VOID SrbSetSrbLength(_In_ PVOID Srb, _In_ ULONG Length)
Definition: srbhelper.h:232
#define STOR_ADDRESS_TYPE_BTL8
Definition: scsi.h:3525
FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByIndex(_In_ PSTORAGE_REQUEST_BLOCK Srb, _In_ ULONG SrbExDataIndex)
Definition: srbhelper.h:47
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 SRBEX_DATA_SCSI_CDB32
FORCEINLINE UCHAR SrbGetSenseInfoBufferLength(_In_ PVOID Srb)
Definition: srbhelper.h:638
FORCEINLINE UCHAR SrbGetPathId(_In_ PVOID Srb)
Definition: srbhelper.h:1151
struct SRB_ALIGN _SRBEX_DATA_WMI SRBEX_DATA_WMI
FORCEINLINE PSRBEX_DATA SrbGetSrbExDataByType(_In_ PSTORAGE_REQUEST_BLOCK Srb, _In_ SRBEXDATATYPE Type)
Definition: srbhelper.h:66
FORCEINLINE UCHAR SrbGetCdbLength(_In_ PVOID Srb)
Definition: srbhelper.h:1074
FORCEINLINE VOID SrbAssignSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:946
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1310
FORCEINLINE VOID SrbSetOriginalRequest(_In_ PVOID Srb, _In_opt_ PVOID OriginalRequest)
Definition: srbhelper.h:710
Type
Definition: Type.h:6
enum _SRBEXDATATYPE SRBEXDATATYPE
PVOID OriginalRequest
Definition: srb.h:258
FORCEINLINE ULONG SrbGetSrbFlags(_In_ PVOID Srb)
Definition: srbhelper.h:927
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR SRBEX_DATA_SCSI_CDB_VAR
struct STOR_ADDRESS_ALIGN _STOR_ADDRESS * PSTOR_ADDRESS
#define SrbZeroMemory(Destination, Length)
Definition: srbhelper.h:36
FORCEINLINE VOID SrbSetDataTransferLength(_In_ PVOID Srb, _In_ ULONG DataTransferLength)
Definition: srbhelper.h:784
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
FORCEINLINE PVOID SrbGetPortContext(_In_ PVOID Srb)
Definition: srbhelper.h:1379
#define SRB_STATUS_AUTOSENSE_VALID
Definition: srb.h:379
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 * PSTOR_ADDR_BTL8
FORCEINLINE PVOID SrbGetNextSrb(_In_ PVOID Srb)
Definition: srbhelper.h:892
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1310
FORCEINLINE VOID SrbSetQueueTag(_In_ PVOID Srb, _In_ ULONG QueueTag)
Definition: srbhelper.h:853
#define TRUE
Definition: types.h:120
struct SRB_ALIGN _SRBEX_DATA * PSRBEX_DATA
#define SrbCopyMemory(Destination, Source, Length)
Definition: srbhelper.h:30
struct SRB_ALIGN _SRBEX_DATA_POWER SRBEX_DATA_POWER
struct SRB_ALIGN _SRBEX_DATA_PNP SRBEX_DATA_PNP
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1310
unsigned char * PUCHAR
Definition: retypes.h:3
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
Definition: cdrw_hw.h:28
FORCEINLINE PSTOR_ADDRESS SrbGetAddress(_In_ PSTORAGE_REQUEST_BLOCK Srb)
Definition: srbhelper.h:139
FORCEINLINE UCHAR SrbGetSrbStatus(_In_ PVOID Srb)
Definition: srbhelper.h:1330
FORCEINLINE PVOID SrbGetOriginalRequest(_In_ PVOID Srb)
Definition: srbhelper.h:693
FORCEINLINE PCDB SrbGetCdb(_In_ PVOID Srb)
Definition: srbhelper.h:583
FORCEINLINE VOID SrbSetSenseInfoBufferLength(_In_ PVOID Srb, _In_ UCHAR SenseInfoBufferLength)
Definition: srbhelper.h:675
FORCEINLINE PVOID SrbGetDataBuffer(_In_ PVOID Srb)
Definition: srbhelper.h:728
FORCEINLINE VOID SrbClearSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:982
FORCEINLINE UCHAR SrbGetLun(_In_ PVOID Srb)
Definition: srbhelper.h:1217
#define _In_opt_
Definition: no_sal2.h:212
#define SRB_FUNCTION_POWER
Definition: srb.h:95
FORCEINLINE ULONG SrbGetDefaultSrbLengthFromFunction(_In_ ULONG SrbFunction)
Definition: srbhelper.h:246
FORCEINLINE UCHAR SrbGetScsiStatus(_In_ PVOID Srb)
Definition: srbhelper.h:1037
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
FORCEINLINE VOID SrbGetPathTargetLun(_In_ PVOID Srb, _In_opt_ PUCHAR PathId, _In_opt_ PUCHAR TargetId, _In_opt_ PUCHAR Lun)
Definition: srbhelper.h:1250
FORCEINLINE VOID SrbSetScsiStatus(_In_ PVOID Srb, _In_ UCHAR ScsiStatus)
Definition: srbhelper.h:1056
#define FALSE
Definition: types.h:117
FORCEINLINE ULONG SrbGetQueueTag(_In_ PVOID Srb)
Definition: srbhelper.h:873
#define __drv_aliasesMem
Definition: btrfs_drv.h:205
FORCEINLINE ULONG SrbGetTimeOutValue(_In_ PVOID Srb)
Definition: srbhelper.h:802
unsigned char BOOLEAN
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 * PSRBEX_DATA_SCSI_CDB16
smooth NULL
Definition: ftsmooth.c:416
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
union _CDB * PCDB
#define FORCEINLINE
Definition: ntbasedef.h:216
#define SRB_FUNCTION_WMI
Definition: srb.h:323
FORCEINLINE ULONG SrbGetSystemStatus(_In_ PVOID Srb)
Definition: srbhelper.h:1000
FORCEINLINE ULONG SrbGetDataTransferLength(_In_ PVOID Srb)
Definition: srbhelper.h:765
FORCEINLINE VOID SrbSetCdbLength(_In_ PVOID Srb, _In_ UCHAR CdbLength)
Definition: srbhelper.h:1093
FORCEINLINE ULONG SrbGetRequestAttribute(_In_ PVOID Srb)
Definition: srbhelper.h:1111
FORCEINLINE VOID SrbSetNextSrb(_In_ PVOID Srb, _In_opt_ PVOID NextSrb)
Definition: srbhelper.h:909
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
FORCEINLINE VOID SrbSetTimeOutValue(_In_ PVOID Srb, _In_ ULONG TimeOutValue)
Definition: srbhelper.h:821
_In_ UCHAR SenseInfoBufferLength
Definition: scsi.h:3705
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
Definition: scratch.h:156
FORCEINLINE ULONG SrbGetSrbFunction(_In_ PVOID Srb)
Definition: srbhelper.h:602
FORCEINLINE PVOID SrbGetMiniportContext(_In_ PVOID Srb)
Definition: srbhelper.h:1313
#define SRBHELPER_ASSERT
Definition: srbhelper.h:12
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB32 * PSRBEX_DATA_SCSI_CDB32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
FORCEINLINE PSRBEX_DATA SrbGetPrimarySrbExData(_In_ PSTORAGE_REQUEST_BLOCK Srb)
Definition: srbhelper.h:94
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
FORCEINLINE VOID SrbSetRequestAttribute(_In_ PVOID Srb, _In_ UCHAR RequestAttribute)
Definition: srbhelper.h:1131
#define SRB_FUNCTION_IO_CONTROL
Definition: srb.h:309
FORCEINLINE VOID SrbZeroSrb(_In_ PVOID Srb)
Definition: srbhelper.h:189
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN _In_opt_ WDFREQUEST OriginalRequest
Definition: cdrom.h:989
#define _In_
Definition: no_sal2.h:158
FORCEINLINE VOID SrbSetSystemStatus(_In_ PVOID Srb, _In_ ULONG Status)
Definition: srbhelper.h:1019
#define SRB_ALIGN_SIZEOF(x)
Definition: srbhelper.h:16
#define SRB_FUNCTION_PNP
Definition: srb.h:96
FORCEINLINE VOID SrbSetPortContext(_In_ PVOID Srb, _In_ PVOID PortContext)
Definition: srbhelper.h:1397
unsigned short USHORT
Definition: pedump.c:61
STORAGE_REQUEST_BLOCK
Definition: srb.h:652
FORCEINLINE PVOID SrbGetSenseInfoBuffer(_In_ PVOID Srb)
Definition: srbhelper.h:619
#define SCSI_REQUEST_BLOCK_SIZE
Definition: srb.h:274
unsigned int * PULONG
Definition: retypes.h:1
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB_VAR * PSRBEX_DATA_SCSI_CDB_VAR
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 STOR_ADDR_BTL8
FORCEINLINE VOID SrbSetDataBuffer(_In_ PVOID Srb, _In_opt_ __drv_aliasesMem PVOID DataBuffer)
Definition: srbhelper.h:747
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
FORCEINLINE VOID SrbSetSrbStatus(_In_ PVOID Srb, _In_ UCHAR status)
Definition: srbhelper.h:1347
unsigned int ULONG
Definition: retypes.h:1
FORCEINLINE VOID SrbSetSenseInfoBuffer(_In_ PVOID Srb, _In_opt_ PVOID SenseInfoBuffer)
Definition: srbhelper.h:657
FORCEINLINE VOID SrbSetSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:964
#define SCSISTAT_GOOD
Definition: cdrw_hw.h:1078
FORCEINLINE ULONG SrbGetSrbLength(_In_ PVOID Srb)
Definition: srbhelper.h:215
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
FORCEINLINE UCHAR SrbGetTargetId(_In_ PVOID Srb)
Definition: srbhelper.h:1184
FORCEINLINE VOID SrbSetQueueSortKey(_In_ PVOID Srb, _In_ ULONG QueueSortKey)
Definition: srbhelper.h:839
static SERVICE_STATUS status
Definition: service.c:31
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
FORCEINLINE BOOLEAN SrbCopySrb(_In_ PVOID DestinationSrb, _In_ ULONG DestinationSrbLength, _In_ PVOID SourceSrb)
Definition: srbhelper.h:159
Definition: ps.c:97