ReactOS  0.4.15-dev-1018-g0695ecb
debug.c
Go to the documentation of this file.
1 /*++
2 
3 Copyright (C) Microsoft Corporation, 1991 - 2010
4 
5 Module Name:
6 
7  debug.c
8 
9 Abstract:
10 
11  CLASSPNP debug code and data
12 
13 Environment:
14 
15  kernel mode only
16 
17 Notes:
18 
19 
20 Revision History:
21 
22 --*/
23 
24 
25 #include "classp.h"
26 #include "debug.h"
27 
28 #ifdef DEBUG_USE_WPP
29 #include "debug.tmh"
30 #endif
31 
32 #if DBG
33 
34  //
35  // default to not breaking in for lost irps, five minutes before we even
36  // bother checking for lost irps, using standard debug print macros, and
37  // using a 64k debug print buffer
38  //
39 
40  #ifndef CLASS_GLOBAL_BREAK_ON_LOST_IRPS
41  #error "CLASS_GLOBAL_BREAK_ON_LOST_IRPS undefined"
42  #define CLASS_GLOBAL_BREAK_ON_LOST_IRPS 0
43  #endif // CLASS_GLOBAL_BREAK_ON_LOST_IRPS
44 
45  #ifndef CLASS_GLOBAL_SECONDS_TO_WAIT_FOR_SYNCHRONOUS_SRB
46  #error "CLASS_GLOBAL_SECONDS_TO_WAIT_FOR_SYNCHRONOUS_SRB undefined"
47  #define CLASS_GLOBAL_SECONDS_TO_WAIT_FOR_SYNCHRONOUS_SRB 300
48  #endif // CLASS_GLOBAL_SECONDS_TO_WAIT_FOR_SYNCHRONOUS_SRB
49 
50  #ifndef CLASS_GLOBAL_BUFFERED_DEBUG_PRINT
51  #error "CLASS_GLOBAL_BUFFERED_DEBUG_PRINT undefined"
52  #define CLASS_GLOBAL_BUFFERED_DEBUG_PRINT 0
53  #endif // CLASS_GLOBAL_BUFFERED_DEBUG_PRINT
54 
55  #ifndef CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE
56  #error "CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE undefined"
57  #define CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE 512
58  #endif // CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE
59 
60  #ifndef CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS
61  #error "CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS undefined"
62  #define CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS 512
63  #endif // CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS
64 
65 #ifdef _MSC_VER
66  #pragma data_seg("NONPAGE")
67 #endif
68 
69 
70 
71  CLASSPNP_GLOBALS ClasspnpGlobals;
72 
73  //
74  // the low sixteen bits are used to see if the debug level is high enough
75  // the high sixteen bits are used to singly enable debug levels 1-16
76  //
77  LONG ClassDebug = 0x00000000;
78 
79  BOOLEAN DebugTrapOnWarn = FALSE;
80 
81  //
82  // Used to track callers when we receive an access and the disk
83  // is powered down.
84  //
85  ULONG DiskSpinupIndex = 0;
86  DISK_SPINUP_TRACES DiskSpinupTraces[NUMBER_OF_DISK_SPINUP_TRACES];
87 
89  {
90  KIRQL irql;
91 
92  if (InterlockedCompareExchange(&ClasspnpGlobals.Initializing, 1, 0) == 0) {
93 
94  KeInitializeSpinLock(&ClasspnpGlobals.SpinLock);
95 
96  KeAcquireSpinLock(&ClasspnpGlobals.SpinLock, &irql);
97 
98  TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_INIT, "CLASSPNP.SYS => Initializing ClasspnpGlobals...\n"));
99 
100  ClasspnpGlobals.Buffer = NULL;
101  ClasspnpGlobals.Index = (ULONG)-1;
102  ClasspnpGlobals.BreakOnLostIrps = CLASS_GLOBAL_BREAK_ON_LOST_IRPS;
103  ClasspnpGlobals.EachBufferSize = CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE;
104  ClasspnpGlobals.NumberOfBuffers = CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS;
105  ClasspnpGlobals.SecondsToWaitForIrps = CLASS_GLOBAL_SECONDS_TO_WAIT_FOR_SYNCHRONOUS_SRB;
106 
107  //
108  // this should be the last item set
109  //
110 
111  ClasspnpGlobals.UseBufferedDebugPrint = CLASS_GLOBAL_BUFFERED_DEBUG_PRINT;
112 
113  KeReleaseSpinLock(&ClasspnpGlobals.SpinLock, irql);
114 
115  InterlockedExchange(&ClasspnpGlobals.Initialized, 1);
116 
117  }
118  }
119 
120  /*++////////////////////////////////////////////////////////////////////////////
121 
122  ClassDebugPrint()
123 
124  Routine Description:
125 
126  Debug print for all class drivers, NOOP on FRE versions.
127  Allows printing to a debug buffer (with auto fallback to kdprint) by
128  properly setting the Globals in classpnp on CHK versions.
129 
130  Arguments:
131 
132  Debug print level, or from 0 to 3 for legacy drivers.
133 
134  Return Value:
135 
136  None
137 
138  --*/
139  VOID ClassDebugPrint(_In_ CLASS_DEBUG_LEVEL DebugPrintLevel, _In_z_ PCCHAR DebugMessage, ...)
140  {
141  va_list ap;
142  va_start(ap, DebugMessage);
143 
144  if ((DebugPrintLevel <= (ClassDebug & 0x0000ffff)) ||
145  ((1 << (DebugPrintLevel + 15)) & ClassDebug)) {
146 
147  if (ClasspnpGlobals.UseBufferedDebugPrint &&
148  ClasspnpGlobals.Buffer == NULL) {
149 
150  //
151  // this double-check prevents always taking
152  // a spinlock just to ensure we have a buffer
153  //
154 
155  KIRQL irql;
156 
157  KeAcquireSpinLock(&ClasspnpGlobals.SpinLock, &irql);
158  if (ClasspnpGlobals.Buffer == NULL) {
159 
160  SIZE_T bufferSize;
161  if (NT_SUCCESS(
162  RtlSIZETMult(ClasspnpGlobals.NumberOfBuffers,
163  ClasspnpGlobals.EachBufferSize,
164  &bufferSize))) {
165 
167  "ClassDebugPrint: Allocating %x bytes for "
168  "classdebugprint buffer\n", (ULONG)bufferSize);
169  ClasspnpGlobals.Index = (ULONG)-1;
170  ClasspnpGlobals.Buffer =
171  ExAllocatePoolWithTag(NonPagedPoolNx, bufferSize, 'bDcS');
173  "ClassDebugPrint: Allocated buffer at %p\n",
174  ClasspnpGlobals.Buffer);
175 
176  if (ClasspnpGlobals.Buffer) {
177  RtlZeroMemory(ClasspnpGlobals.Buffer, bufferSize);
178  }
179  }
180 
181  }
182  KeReleaseSpinLock(&ClasspnpGlobals.SpinLock, irql);
183 
184  }
185 
186  if (ClasspnpGlobals.UseBufferedDebugPrint &&
187  ClasspnpGlobals.Buffer != NULL) {
188 
189  //
190  // we never free the buffer, so once it exists,
191  // we can just print to it with immunity
192  //
193 
194  ULONG index;
195  PUCHAR buffer;
197  index = InterlockedIncrement((volatile LONG *)&ClasspnpGlobals.Index);
198  index %= ClasspnpGlobals.NumberOfBuffers;
199  index *= (ULONG)ClasspnpGlobals.EachBufferSize;
200 
201  buffer = ClasspnpGlobals.Buffer;
202  buffer += index;
203 
204  RtlZeroMemory(buffer, ClasspnpGlobals.EachBufferSize);
205 
206  status = RtlStringCchVPrintfA((NTSTRSAFE_PSTR)buffer, ClasspnpGlobals.EachBufferSize, DebugMessage, ap);
207  if (!NT_SUCCESS(status))
208  {
209  *buffer = 0; // force-null on failure
210  }
211 
212  } else {
213 
214  //
215  // either we could not allocate a buffer for debug prints
216  // or buffered debug prints are disabled
217  //
218 
220 
221  }
222 
223  }
224 
225  va_end(ap);
226 
227  }
228 
229 
230  /*
231  * DbgCheckReturnedPkt
232  *
233  * Check a completed TRANSFER_PACKET for all sorts of error conditions
234  * and warn/trap appropriately.
235  */
236  VOID DbgCheckReturnedPkt(TRANSFER_PACKET *Pkt)
237  {
239 
243  NT_ASSERT(!Pkt->Irp->CancelRoutine);
244 
245  if (SRB_STATUS(Pkt->Srb->SrbStatus) == SRB_STATUS_PENDING){
246  TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "SRB completed with status PENDING in packet %ph: (op=%s srbstat=%s(%xh), irpstat=%xh)",
247  Pkt,
250  (ULONG)Pkt->Srb->SrbStatus,
251  Pkt->Irp->IoStatus.Status));
252  }
253  else if (SRB_STATUS(Pkt->Srb->SrbStatus) == SRB_STATUS_SUCCESS){
254  /*
255  * Make sure SRB and IRP status match.
256  */
257  if (!NT_SUCCESS(Pkt->Irp->IoStatus.Status)){
258  TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_RW, "SRB and IRP status don't match in packet %ph: (op=%s srbstat=%s(%xh), irpstat=%xh)",
259  Pkt,
262  (ULONG)Pkt->Srb->SrbStatus,
263  Pkt->Irp->IoStatus.Status));
264  }
265 
267  TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "SRB and IRP result transfer lengths don't match in succeeded packet %ph: (op=%s, SrbStatus=%s, Srb.DataTransferLength=%xh, Irp->IoStatus.Information=%Ixh).",
268  Pkt,
273  }
274  }
275  else {
276  if (NT_SUCCESS(Pkt->Irp->IoStatus.Status)){
277  TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_RW, "SRB and IRP status don't match in packet %ph: (op=%s srbstat=%s(%xh), irpstat=%xh)",
278  Pkt,
281  (ULONG)Pkt->Srb->SrbStatus,
282  Pkt->Irp->IoStatus.Status));
283  }
284  TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_RW, "Packet %ph failed (op=%s srbstat=%s(%xh), irpstat=%xh, sense=%s/%s/%s)",
285  Pkt,
288  (ULONG)Pkt->Srb->SrbStatus,
293 
294  /*
295  * If the SRB failed with underrun or overrun, then the actual
296  * transferred length should be returned in both SRB and IRP.
297  * (SRB's only have an error status for overrun, so it's overloaded).
298  */
299  if ((SRB_STATUS(Pkt->Srb->SrbStatus) == SRB_STATUS_DATA_OVERRUN) &&
301  TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "SRB and IRP result transfer lengths don't match in failed packet %ph: (op=%s, SrbStatus=%s, Srb.DataTransferLength=%xh, Irp->IoStatus.Information=%Ixh).",
302  Pkt,
307  }
308  }
309 
310  /*
311  * If the port driver returned STATUS_INSUFFICIENT_RESOURCES,
312  * make sure this is also the InternalStatus in the SRB so that we process it correctly.
313  */
317  }
318 
319  /*
320  * Some miniport drivers have been caught changing the SCSI operation
321  * code in the SRB. This is absolutely disallowed as it breaks our error handling.
322  */
323  switch (pCdb->CDB10.OperationCode){
325  case SCSIOP_MODE_SENSE:
327  case SCSIOP_READ:
328  case SCSIOP_WRITE:
331  case SCSIOP_READ16:
332  case SCSIOP_WRITE16:
333  break;
334  default:
335  TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_RW, "Miniport illegally changed Srb.Cdb.OperationCode in packet %ph failed (op=%s srbstat=%s(%xh), irpstat=%xh, sense=%s/%s/%s)",
336  Pkt,
339  (ULONG)Pkt->Srb->SrbStatus,
344  break;
345  }
346 
347  }
348 
349 
350  VOID DbgLogSendPacket(TRANSFER_PACKET *Pkt)
351  {
353  PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
354  KIRQL oldIrql;
355 
356  if (Pkt->OriginalIrp){
357  Pkt->DbgOriginalIrpCopy = *Pkt->OriginalIrp;
358  if (Pkt->OriginalIrp->MdlAddress){
359  Pkt->DbgMdlCopy = *Pkt->OriginalIrp->MdlAddress;
360  }
361  }
362 
363  KeQueryTickCount(&Pkt->DbgTimeSent);
364  Pkt->DbgTimeReturned.QuadPart = 0L;
365 
366  KeAcquireSpinLock(&fdoData->SpinLock, &oldIrql);
367  fdoData->DbgPacketLogs[fdoData->DbgPacketLogNextIndex] = *Pkt;
368  fdoData->DbgPacketLogNextIndex++;
369  fdoData->DbgPacketLogNextIndex %= DBG_NUM_PACKET_LOG_ENTRIES;
370  KeReleaseSpinLock(&fdoData->SpinLock, oldIrql);
371  }
372 
373  VOID DbgLogReturnPacket(TRANSFER_PACKET *Pkt)
374  {
376  PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
377  KIRQL oldIrql;
378 
379  KeQueryTickCount(&Pkt->DbgTimeReturned);
380 
381  #if 0
382  // ISSUE: there are some problems with this check (e.g. multiproc), so don't include it yet
383  if (Pkt->OriginalIrp){
384  /*
385  * No one should have touched the original irp while the packet was outstanding,
386  * except for a couple fields that we ourselves update during the transfer
387  * or that are allowed to change;
388  * make those couple fields the same and then to a bytewise compare
389  */
390  ULONG lenSame;
391 
392  Pkt->DbgOriginalIrpCopy.IoStatus.Status = Pkt->OriginalIrp->IoStatus.Status;
393  Pkt->DbgOriginalIrpCopy.IoStatus.Information = Pkt->OriginalIrp->IoStatus.Information;
394  Pkt->DbgOriginalIrpCopy.Tail.Overlay.DriverContext[0] = Pkt->OriginalIrp->Tail.Overlay.DriverContext[0];
395  Pkt->DbgOriginalIrpCopy.ThreadListEntry = Pkt->OriginalIrp->ThreadListEntry;
396  Pkt->DbgOriginalIrpCopy.Cancel = Pkt->OriginalIrp->Cancel;
397 
398  lenSame = (ULONG)RtlCompareMemory(Pkt->OriginalIrp, &Pkt->DbgOriginalIrpCopy, sizeof(IRP));
399  NT_ASSERT(lenSame == sizeof(IRP));
400  }
401  #endif
402 
403  KeAcquireSpinLock(&fdoData->SpinLock, &oldIrql);
404  fdoData->DbgPacketLogs[fdoData->DbgPacketLogNextIndex] = *Pkt;
405  fdoData->DbgPacketLogNextIndex++;
406  fdoData->DbgPacketLogNextIndex %= DBG_NUM_PACKET_LOG_ENTRIES;
407  KeReleaseSpinLock(&fdoData->SpinLock, oldIrql);
408  }
409 
410 
411  /*++////////////////////////////////////////////////////////////////////////////
412 
413  DbgSafeInc()
414 
415  Routine Description:
416 
417  Safely increments a ULONG. If the increment would result in an overflow,
418  the value is unchanged.
419 
420  Arguments:
421 
422  A pointer to the value to be incremented.
423 
424  --*/
425  __inline VOID DbgSafeInc(PULONG pValue)
426  {
427  ULONG incrementResult;
428  if(NT_SUCCESS(RtlULongAdd(*pValue, 1, &incrementResult))) {
429  *pValue = incrementResult;
430  } else {
431  //
432  // Leave *pValue unchanged (i.e. at ULONG_MAX).
433  //
434  }
435  }
436 
437  VOID DbgLogFlushInfo(PCLASS_PRIVATE_FDO_DATA FdoData, BOOLEAN IsIO, BOOLEAN IsFUA, BOOLEAN IsFlush)
438  {
439 
440  /*
441  * Reset all FUA/Flush logging fields.
442  */
443  if (FdoData->DbgInitFlushLogging){
444  FdoData->DbgNumIORequests = 0;
445  FdoData->DbgNumFUAs = 0;
446  FdoData->DbgNumFlushes = 0;
447  FdoData->DbgIOsSinceFUA = 0;
448  FdoData->DbgIOsSinceFlush = 0;
449  FdoData->DbgAveIOsToFUA = 0;
450  FdoData->DbgAveIOsToFlush = 0;
451  FdoData->DbgMaxIOsToFUA = 0;
452  FdoData->DbgMaxIOsToFlush = 0;
453  FdoData->DbgMinIOsToFUA = 0xffffffff;
454  FdoData->DbgMinIOsToFlush = 0xffffffff;
455  FdoData->DbgInitFlushLogging = FALSE;
456  }
457 
458  //
459  // Using DbgSafeInc for all increments (instead of ++) guarantees
460  // that there will be no overflow hence no division by 0. All counters
461  // are capped at ULONG_MAX.
462  //
463 
464  if (IsIO){
465  DbgSafeInc(&FdoData->DbgNumIORequests);
466  DbgSafeInc(&FdoData->DbgIOsSinceFlush);
467  if (IsFUA){
468  if (FdoData->DbgNumFUAs > 0){
469  FdoData->DbgMinIOsToFUA = min(FdoData->DbgMinIOsToFUA, FdoData->DbgIOsSinceFUA);
470  }
471  DbgSafeInc(&FdoData->DbgNumFUAs);
472  FdoData->DbgAveIOsToFUA = FdoData->DbgNumIORequests/FdoData->DbgNumFUAs;
473  FdoData->DbgIOsSinceFUA = 0;
474  }
475  else {
476  DbgSafeInc(&FdoData->DbgIOsSinceFUA);
477  FdoData->DbgMaxIOsToFUA = max(FdoData->DbgMaxIOsToFUA, FdoData->DbgIOsSinceFUA);
478  }
479  FdoData->DbgMaxIOsToFlush = max(FdoData->DbgMaxIOsToFlush, FdoData->DbgIOsSinceFlush);
480  }
481  else if (IsFlush){
482  if (FdoData->DbgNumFlushes > 0){
483  FdoData->DbgMinIOsToFlush = min(FdoData->DbgMinIOsToFlush, FdoData->DbgIOsSinceFlush);
484  }
485  DbgSafeInc(&FdoData->DbgNumFlushes);
486  FdoData->DbgAveIOsToFlush = FdoData->DbgNumIORequests/FdoData->DbgNumFlushes;
487  FdoData->DbgIOsSinceFlush = 0;
488  }
489 
490  }
491 
492 
493  /*++////////////////////////////////////////////////////////////////////////////
494 
495  SnapDiskStartup()
496 
497  Routine Description:
498 
499  This function will attempt to record the caller responsible for spinning
500  up the disk.
501 
502  Arguments:
503 
504  NONE.
505 
506  Return Value:
507 
508  NONE.
509 
510  --*/
511  VOID
513  VOID
514  )
515  {
516  ULONG Index;
517  PDISK_SPINUP_TRACES Entry;
518  LARGE_INTEGER SpinUpTime;
519 
520 #ifdef _MSC_VER
521 #pragma warning(push)
522 #pragma warning(disable:4210) // nonstandard extension used : function given file scope
523 #endif
525  _In_ ULONG FramesToSkip,
526  _In_ ULONG FramesToCapture,
527  _Out_writes_to_(FramesToCapture, return) PVOID * BackTrace,
528  _Out_opt_ PULONG BackTraceHash );
529 #ifdef _MSC_VER
530 #pragma warning(pop)
531 #endif
532 
533  //
534  // Grab the current count, then mod it so that it
535  // becomes an index into the DiskSpinupTraces array.
536  //
537  Index = InterlockedIncrement( (volatile LONG *)&DiskSpinupIndex );
538  Index = Index & (NUMBER_OF_DISK_SPINUP_TRACES - 1);
539  Entry = &DiskSpinupTraces[Index];
540 
541  //
542  // Timestamp the instance.
543  //
544  KeQueryTickCount(&SpinUpTime);
545  SpinUpTime.QuadPart = (SpinUpTime.QuadPart * KeQueryTimeIncrement())/(10000000);
546 
547 
548  //
549  // Ask the kernel to read back up our stack by
550  // DISK_SPINUP_BACKTRACE_LENGTH frames.
551  //
552  Entry->TimeStamp.QuadPart = SpinUpTime.QuadPart;
553  RtlZeroMemory( &Entry->StackTrace[0], DISK_SPINUP_BACKTRACE_LENGTH * sizeof(PVOID) );
554  RtlCaptureStackBackTrace( 5, // stacks to skip
555  DISK_SPINUP_BACKTRACE_LENGTH, // buffer size
556  Entry->StackTrace,
557  &Index );
558  }
559 
560 #else
561 
562  // We have to keep this in the retail build for legacy.
563  VOID ClassDebugPrint(_In_ CLASS_DEBUG_LEVEL DebugPrintLevel, _In_z_ PCCHAR DebugMessage, ...)
564  {
565  UNREFERENCED_PARAMETER(DebugPrintLevel);
566  UNREFERENCED_PARAMETER(DebugMessage);
567  }
568 
569 #endif
570 
572  {
573  char *ioctlStr = "?";
574 
575  switch (ioctl){
576 
577  #undef MAKE_CASE
578  #define MAKE_CASE(ioctlCode) case ioctlCode: ioctlStr = #ioctlCode; break;
579 
604  }
605 
606  return ioctlStr;
607  }
608 
610  {
611  PCDB pCdb = SrbGetCdb(Srb);
612  char *scsiOpStr = "?";
613 
614  if (pCdb) {
615 
616  switch (pCdb->CDB6GENERIC.OperationCode){
617 
618  #undef MAKE_CASE
619  #define MAKE_CASE(scsiOpCode) case scsiOpCode: scsiOpStr = #scsiOpCode; break;
620 
622  MAKE_CASE(SCSIOP_REWIND) // aka SCSIOP_REZERO_UNIT
627  MAKE_CASE(SCSIOP_INIT_ELEMENT_STATUS) // aka SCSIOP_REASSIGN_BLOCKS
628  MAKE_CASE(SCSIOP_RECEIVE) // aka SCSIOP_READ6
629  MAKE_CASE(SCSIOP_SEND) // aka SCSIOP_WRITE6, SCSIOP_PRINT
630  MAKE_CASE(SCSIOP_SLEW_PRINT) // aka SCSIOP_SEEK6, SCSIOP_TRACK_SELECT
634  MAKE_CASE(SCSIOP_FLUSH_BUFFER) // aka SCSIOP_WRITE_FILEMARKS
645  MAKE_CASE(SCSIOP_START_STOP_UNIT) // aka SCSIOP_STOP_PRINT, SCSIOP_LOAD_UNLOAD
653  MAKE_CASE(SCSIOP_SEEK) // aka SCSIOP_LOCATE, SCSIOP_POSITION_TO_ELEMENT
696  MAKE_CASE(SCSIOP_LOAD_UNLOAD_SLOT) // aka SCSIOP_EXCHANGE_MEDIUM
715  }
716  }
717 
718  return scsiOpStr;
719  }
720 
721 
723  {
724  char *srbStatStr = "?";
725 
726  switch (Srb->SrbStatus){
727 
728  #undef MAKE_CASE
729  #define MAKE_CASE(srbStat) \
730  case srbStat: \
731  srbStatStr = #srbStat; \
732  break; \
733  case srbStat|SRB_STATUS_QUEUE_FROZEN: \
734  srbStatStr = #srbStat "|SRB_STATUS_QUEUE_FROZEN"; \
735  break; \
736  case srbStat|SRB_STATUS_AUTOSENSE_VALID: \
737  srbStatStr = #srbStat "|SRB_STATUS_AUTOSENSE_VALID"; \
738  break; \
739  case srbStat|SRB_STATUS_QUEUE_FROZEN|SRB_STATUS_AUTOSENSE_VALID: \
740  srbStatStr = #srbStat "|SRB_STATUS_QUEUE_FROZEN|SRB_STATUS_AUTOSENSE_VALID"; \
741  break;
742 
771  }
772 
773  return srbStatStr;
774  }
775 
776 
778  {
779  char *senseCodeStr = "?";
780 
781  if (Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID){
782 
783  PVOID senseData;
784  UCHAR senseCode;
786 
787  senseData = SrbGetSenseInfoBuffer(Srb);
788  NT_ASSERT(senseData);
789 
790  validSense = ScsiGetSenseKeyAndCodes(senseData,
793  &senseCode,
794  NULL,
795  NULL);
796  if (validSense) {
797  switch (senseCode){
798 
799  #undef MAKE_CASE
800  #define MAKE_CASE(snsCod) case snsCod: senseCodeStr = #snsCod; break;
801 
818  }
819  }
820  }
821 
822  return senseCodeStr;
823  }
824 
825 
827  {
828  char *adSenseCodeStr = "?";
829 
830  if (Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID){
831  PVOID senseData;
832  UCHAR adSenseCode;
834 
835  senseData = SrbGetSenseInfoBuffer(Srb);
836  NT_ASSERT(senseData);
837 
838  validSense = ScsiGetSenseKeyAndCodes(senseData,
841  NULL,
842  &adSenseCode,
843  NULL);
844 
845  if (validSense) {
846  switch (adSenseCode){
847 
848  #undef MAKE_CASE
849  #define MAKE_CASE(adSnsCod) case adSnsCod: adSenseCodeStr = #adSnsCod; break;
850 
861  MAKE_CASE(SCSI_ADSENSE_WRITE_PROTECT) // aka SCSI_ADWRITE_PROTECT
874  }
875  }
876  }
877 
878  return adSenseCodeStr;
879  }
880 
881 
883  {
884  char *adSenseCodeQualStr = "?";
885 
886  if (Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID){
887  PVOID senseData;
888  UCHAR adSenseCode;
889  UCHAR adSenseCodeQual;
891 
892  senseData = SrbGetSenseInfoBuffer(Srb);
893  NT_ASSERT(senseData);
894 
895  validSense = ScsiGetSenseKeyAndCodes(senseData,
898  NULL,
899  &adSenseCode,
900  &adSenseCodeQual);
901  if (validSense) {
902  switch (adSenseCode){
903 
904  #undef MAKE_CASE
905  #define MAKE_CASE(adSnsCodQual) case adSnsCodQual: adSenseCodeQualStr = #adSnsCodQual; break;
906 
908  switch (adSenseCodeQual){
918  }
919  break;
921  switch (adSenseCodeQual){
926  }
927  break;
929  switch (adSenseCodeQual){
931  }
932  break;
934  switch (adSenseCodeQual){
937  }
938  break;
940  switch (adSenseCodeQual){
945  }
946  break;
948  switch (adSenseCodeQual){
953  }
954  break;
956  switch (adSenseCodeQual){
963  }
964  break;
965  }
966  }
967  }
968 
969  return adSenseCodeQualStr;
970  }
971 
972 
#define IOCTL_STORAGE_MCN_CONTROL
Definition: ntddstor.h:117
VOID ClassDebugPrint(_In_ CLASS_DEBUG_LEVEL DebugPrintLevel, _In_z_ PCCHAR DebugMessage,...)
Definition: debug.c:563
#define SCSIOP_SEARCH_DATA_LOW
Definition: cdrw_hw.h:915
#define SRB_STATUS_INVALID_REQUEST
Definition: srb.h:338
#define SCSIOP_READ_TOC
Definition: cdrw_hw.h:927
#define SRB_STATUS_BUS_RESET
Definition: srb.h:345
#define SCSI_ADSENSE_WRITE_PROTECT
Definition: cdrw_hw.h:1268
#define SCSIOP_RESERVE_UNIT
Definition: cdrw_hw.h:892
#define SCSIOP_MOVE_MEDIUM
Definition: scsi.h:379
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS
Definition: cdrw_hw.h:1316
#define SCSI_SENSEQ_STATE_CHANGE_INPUT
Definition: scsi.h:877
#define max(a, b)
Definition: svc.c:63
FORCEINLINE UCHAR SrbGetSenseInfoBufferLength(_In_ PVOID Srb)
Definition: srbhelper.h:638
#define SCSIOP_SEARCH_DATA_EQUAL
Definition: cdrw_hw.h:914
_In_ PTRANSFER_PACKET Pkt
Definition: classp.h:1754
#define SCSIOP_PLAY_TRACK_RELATIVE
Definition: cdrw_hw.h:933
#define SCSIOP_SYNCHRONIZE_CACHE
Definition: cdrw_hw.h:918
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define SCSIOP_READ_SUB_CHANNEL
Definition: cdrw_hw.h:926
#define SCSIOP_PERSISTENT_RESERVE_IN
Definition: scsi.h:328
#define SCSIOP_SEEK
Definition: cdrw_hw.h:908
#define SCSIOP_WRITE_DATA_BUFF
Definition: cdrw_hw.h:922
#define SCSIOP_RESERVE_TRACK_RZONE
Definition: scsi.h:316
#define SCSIOP_GET_EVENT_STATUS
Definition: cdrw_hw.h:934
NTSTRSAFEAPI RtlStringCchVPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat, _In_ va_list argList)
Definition: ntstrsafe.h:984
struct _Entry Entry
Definition: kefuncs.h:627
#define IOCTL_STORAGE_MEDIA_REMOVAL
Definition: ntddstor.h:93
#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT
Definition: cdrw_hw.h:1323
#define SCSI_SENSEQ_MEDIUM_REMOVAL
Definition: scsi.h:878
#define SCSIOP_RELEASE_UNIT
Definition: cdrw_hw.h:893
#define SCSI_SENSE_UNIQUE
Definition: cdrw_hw.h:1196
#define SRB_STATUS_AUTOSENSE_VALID
Definition: srb.h:379
#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE
Definition: scsi.h:693
#define SCSIOP_MODE_SENSE
Definition: cdrw_hw.h:896
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SCSIOP_SPACE
Definition: cdrw_hw.h:887
#define SRB_STATUS_ABORT_FAILED
Definition: srb.h:335
char * DbgGetScsiOpStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:609
#define SCSIOP_REQUEST_VOL_ELEMENT
Definition: scsi.h:399
#define DPFLTR_INFO_LEVEL
Definition: kdtypes.h:33
#define SCSIOP_PLAY_AUDIO
Definition: cdrw_hw.h:929
unsigned char * PUCHAR
Definition: retypes.h:3
#define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION
Definition: cdrw_hw.h:1393
Definition: cdrw_hw.h:28
LONG NTSTATUS
Definition: precomp.h:26
#define SRB_STATUS_REQUEST_FLUSHED
Definition: srb.h:353
#define IOCTL_STORAGE_PERSISTENT_RESERVE_OUT
Definition: ntddstor.h:161
#define SCSIOP_SEND_KEY
Definition: cdrw_hw.h:951
#define SCSIOP_TEST_UNIT_READY
Definition: cdrw_hw.h:866
KSPIN_LOCK SpinLock
Definition: classp.h:795
#define SCSI_SENSE_EQUAL
Definition: cdrw_hw.h:1199
#define IOCTL_STORAGE_RESET_DEVICE
Definition: ntddstor.h:129
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
#define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED
Definition: cdrw_hw.h:1441
#define IOCTL_STORAGE_GET_HOTPLUG_INFO
Definition: imports.h:238
#define SCSIOP_REPORT_KEY
Definition: cdrw_hw.h:952
#define SCSIOP_CHANGE_DEFINITION
Definition: cdrw_hw.h:924
#define SCSI_ADSENSE_MUSIC_AREA
Definition: cdrw_hw.h:1282
#define SCSI_ADSENSE_DATA_AREA
Definition: cdrw_hw.h:1283
#define SRB_STATUS_COMMAND_TIMEOUT
Definition: srb.h:343
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define SRB_STATUS_MESSAGE_REJECTED
Definition: srb.h:344
#define SCSIOP_SYNCHRONIZE_CACHE16
Definition: scsi.h:354
#define SCSI_SENSEQ_END_OF_MEDIA_DETECTED
Definition: cdrw_hw.h:1440
#define SRB_STATUS_NO_DEVICE
Definition: srb.h:340
GLuint buffer
Definition: glext.h:5915
#define SRB_STATUS_PHASE_SEQUENCE_FAILURE
Definition: srb.h:351
#define SCSI_SENSE_MISCOMPARE
Definition: cdrw_hw.h:1201
#define DBGGETSENSECODESTR(_pSrb)
Definition: debug.h:28
#define SCSI_SENSE_OPTIONS_FIXED_FORMAT_IF_UNKNOWN_FORMAT_INDICATED
Definition: scsi.h:3838
PSTORAGE_REQUEST_BLOCK_HEADER Srb
Definition: classp.h:580
#define SCSI_ADSENSE_LUN_NOT_READY
Definition: cdrw_hw.h:1218
#define SCSIOP_LOAD_UNLOAD_SLOT
Definition: cdrw_hw.h:954
IO_STATUS_BLOCK IoStatus
char * DbgGetSrbStatusStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:722
#define SCSI_SENSEQ_REBUILD_IN_PROGRESS
Definition: scsi.h:726
FORCEINLINE PVOID SrbGetOriginalRequest(_In_ PVOID Srb)
Definition: srbhelper.h:693
FORCEINLINE PCDB SrbGetCdb(_In_ PVOID Srb)
Definition: srbhelper.h:583
#define SCSIOP_WRITE16
Definition: scsi.h:915
struct _CDB::_CDB10 CDB10
#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH
Definition: srb.h:352
#define SCSIOP_SEND_OPC_INFORMATION
Definition: scsi.h:317
#define SCSIOP_READ_BLOCK_LIMITS
Definition: cdrw_hw.h:872
FORCEINLINE PVOID SrbGetDataBuffer(_In_ PVOID Srb)
Definition: srbhelper.h:728
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
#define SCSI_SENSE_NOT_READY
Definition: cdrw_hw.h:1189
#define SRB_STATUS_INVALID_TARGET_ID
Definition: srb.h:355
#define NTSYSAPI
Definition: ntoskrnl.h:14
#define _Out_writes_to_(size, count)
Definition: no_sal2.h:378
#define DBG_NUM_PACKET_LOG_ENTRIES
Definition: classp.h:487
#define SRB_STATUS(Status)
Definition: srb.h:381
#define SCSIOP_READ_BUFFER_CAPACITY
Definition: cdrw_hw.h:948
#define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS
Definition: scsi.h:727
#define SCSIOP_ERASE
Definition: cdrw_hw.h:895
#define SCSIOP_SEND_CUE_SHEET
Definition: cdrw_hw.h:949
#define SCSI_ADSENSE_VOLUME_OVERFLOW
Definition: cdrw_hw.h:1284
#define SCSIOP_PLAY_TRACK_INDEX
Definition: cdrw_hw.h:932
struct SRB_ALIGN _STORAGE_REQUEST_BLOCK_HEADER * PSTORAGE_REQUEST_BLOCK_HEADER
#define SCSIOP_REWIND
Definition: cdrw_hw.h:868
#define SRB_STATUS_ERROR
Definition: srb.h:336
#define IOCTL_STORAGE_FIND_NEW_DEVICES
Definition: ntddstor.h:111
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define SCSI_SENSE_MEDIUM_ERROR
Definition: cdrw_hw.h:1190
#define SCSI_ADSENSE_OPERATOR_REQUEST
Definition: scsi.h:690
#define SCSI_ADSENSE_REC_DATA_NOECC
Definition: cdrw_hw.h:1211
#define SCSI_ADSENSE_NO_SENSE
Definition: cdrw_hw.h:1207
#define SCSIOP_SLEW_PRINT
Definition: cdrw_hw.h:881
#define SRB_STATUS_REQUEST_SENSE_FAILED
Definition: srb.h:347
#define SCSI_SENSEQ_SETMARK_DETECTED
Definition: cdrw_hw.h:1439
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define va_end(ap)
Definition: acmsvcex.h:90
#define SRB_STATUS_PARITY_ERROR
Definition: srb.h:346
#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED
Definition: cdrw_hw.h:1315
#define FALSE
Definition: types.h:117
#define SCSIOP_READ_CD_MSF
Definition: cdrw_hw.h:964
long LONG
Definition: pedump.c:60
#define SCSI_SENSEQ_SOURCE_EMPTY
Definition: scsi.h:811
#define SCSI_SENSE_VOL_OVERFLOW
Definition: cdrw_hw.h:1200
#define ioctl
Definition: wintirpc.h:60
#define SCSIOP_INIT_ELEMENT_RANGE
Definition: scsi.h:418
PDEVICE_OBJECT Fdo
Definition: classp.h:503
#define SCSIOP_READ
Definition: cdrw_hw.h:905
#define DBGGETADSENSEQUALIFIERSTR(_pSrb)
Definition: debug.h:30
#define SCSIOP_READ16
Definition: scsi.h:914
#define IOCTL_STORAGE_EJECTION_CONTROL
Definition: ntddstor.h:114
#define SCSIOP_SEND_VOLUME_TAG
Definition: scsi.h:401
#define IOCTL_STORAGE_RELEASE
Definition: ntddstor.h:108
#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE
Definition: cdrw_hw.h:1221
#define IOCTL_STORAGE_EJECT_MEDIA
Definition: ntddstor.h:96
#define SCSIOP_RECEIVE
Definition: cdrw_hw.h:875
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
#define SCSIOP_STOP_PLAY_SCAN
Definition: cdrw_hw.h:938
#define SRB_STATUS_PENDING
Definition: srb.h:332
#define SCSIOP_SEND
Definition: cdrw_hw.h:878
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define SCSIOP_WRITE
Definition: cdrw_hw.h:906
unsigned char BOOLEAN
#define SCSIOP_MODE_SENSE10
Definition: cdrw_hw.h:946
smooth NULL
Definition: ftsmooth.c:416
#define SRB_STATUS_NO_HBA
Definition: srb.h:348
char * DbgGetIoctlStr(ULONG ioctl)
Definition: debug.c:571
#define SRB_STATUS_ABORTED
Definition: srb.h:334
#define SnapDiskStartup()
Definition: debug.h:124
#define SCSIOP_READ_FORMATTED_CAPACITY
Definition: scsi.h:272
char * va_list
Definition: acmsvcex.h:78
ULONG NTAPI vDbgPrintEx(IN ULONG ComponentId, IN ULONG Level, IN PCCH Format, IN va_list ap)
Definition: debug.c:186
#define IOCTL_STORAGE_GET_DEVICE_NUMBER
Definition: ntddstor.h:132
GLuint index
Definition: glext.h:6031
#define SCSIOP_FLUSH_BUFFER
Definition: cdrw_hw.h:886
#define SRB_STATUS_BUSY
Definition: srb.h:337
#define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT
Definition: cdrw_hw.h:1394
FORCEINLINE ULONG SrbGetSystemStatus(_In_ PVOID Srb)
Definition: srbhelper.h:1000
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
Definition: clock.c:165
FORCEINLINE ULONG SrbGetDataTransferLength(_In_ PVOID Srb)
Definition: srbhelper.h:765
#define IOCTL_STORAGE_RESERVE
Definition: ntddstor.h:105
#define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR
Definition: scsi.h:786
#define SCSIOP_READ_HEADER
Definition: cdrw_hw.h:928
#define SCSIOP_READ_DATA_BUFF
Definition: cdrw_hw.h:923
#define SCSIOP_INQUIRY
Definition: cdrw_hw.h:888
#define IOCTL_STORAGE_CHECK_VERIFY
Definition: ntddstor.h:87
#define OBSOLETE_IOCTL_STORAGE_RESET_BUS
Definition: ntddstor.h:149
#define _Out_opt_
Definition: no_sal2.h:339
#define SRB_STATUS_BAD_FUNCTION
Definition: srb.h:356
#define SRB_STATUS_ERROR_RECOVERY
Definition: srb.h:357
char * DbgGetSenseCodeStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:777
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:167
#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX
Definition: cdrw_usr.h:190
#define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER
Definition: ntddstor.h:140
PIRP OriginalIrp
Definition: classp.h:509
#define SCSI_SENSE_BLANK_CHECK
Definition: cdrw_hw.h:1195
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS
Definition: cdrw_hw.h:1318
#define SCSI_ADSENSE_SEEK_ERROR
Definition: cdrw_hw.h:1232
#define SCSIOP_VERIFY16
Definition: scsi.h:916
#define SCSI_ADSENSE_ILLEGAL_BLOCK
Definition: cdrw_hw.h:1264
#define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED
Definition: scsi.h:691
#define OBSOLETE_IOCTL_STORAGE_RESET_DEVICE
Definition: ntddstor.h:152
#define SCSI_SENSEQ_BECOMING_READY
Definition: cdrw_hw.h:1313
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IOCTL_STORAGE_PERSISTENT_RESERVE_IN
Definition: ntddstor.h:158
#define SRB_STATUS_NOT_POWERED
Definition: srb.h:358
#define SCSI_ADSENSE_VENDOR_UNIQUE
Definition: cdrw_hw.h:1281
#define SCSIOP_READ_TRACK_INFORMATION
Definition: scsi.h:314
#define SCSI_ADSENSE_INVALID_MEDIA
Definition: cdrw_hw.h:1220
#define SCSIOP_READ_REVERSE
Definition: cdrw_hw.h:884
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
static const UCHAR Index[8]
Definition: usbohci.c:18
#define SCSI_ADSENSE_REC_DATA_ECC
Definition: cdrw_hw.h:1212
#define SCSIOP_REPORT_LUNS
Definition: scsi.h:921
#define SCSIOP_PLAY_AUDIO_MSF
Definition: cdrw_hw.h:931
#define SCSIOP_SET_CD_SPEED
Definition: cdrw_hw.h:965
#define IOCTL_STORAGE_LOAD_MEDIA2
Definition: ntddk_ex.h:210
#define SCSI_SENSEQ_OPERATION_IN_PROGRESS
Definition: cdrw_hw.h:1317
#define SRB_STATUS_DATA_OVERRUN
Definition: srb.h:349
#define SCSIOP_SEARCH_DATA_HIGH
Definition: cdrw_hw.h:913
#define SCSIOP_READ_DISK_INFORMATION
Definition: scsi.h:312
#define SCSIOP_VERIFY
Definition: cdrw_hw.h:912
#define DBGGETSCSIOPSTR(_pSrb)
Definition: debug.h:26
#define SCSIOP_SCAN_CD
Definition: scsi.h:406
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define SCSI_SENSEQ_KEY_NOT_ESTABLISHED
Definition: cdrw_hw.h:1392
#define SCSI_SENSE_HARDWARE_ERROR
Definition: cdrw_hw.h:1191
unsigned char UCHAR
Definition: xmlstorage.h:181
#define index(s, c)
Definition: various.h:29
#define SRB_STATUS_INTERNAL_ERROR
Definition: srb.h:365
#define SCSI_SENSE_COPY_ABORTED
Definition: cdrw_hw.h:1197
static const WCHAR L[]
Definition: oid.c:1250
#define SCSI_SENSEQ_UNKNOWN_FORMAT
Definition: cdrw_hw.h:1322
#define SCSI_SENSEQ_KEY_NOT_PRESENT
Definition: cdrw_hw.h:1391
#define SCSIOP_READ_CAPACITY16
Definition: scsi.h:363
#define SCSIOP_MEDIUM_REMOVAL
Definition: cdrw_hw.h:902
#define SCSI_ADSENSE_BUS_RESET
Definition: cdrw_hw.h:1289
#define SCSIOP_FORMAT_UNIT
Definition: cdrw_hw.h:871
#define IOCTL_STORAGE_CHECK_VERIFY2
Definition: ntddk_ex.h:212
#define SRB_STATUS_SELECTION_TIMEOUT
Definition: srb.h:342
#define SCSI_SENSE_RECOVERED_ERROR
Definition: cdrw_hw.h:1188
#define SCSI_SENSE_ABORTED_COMMAND
Definition: cdrw_hw.h:1198
#define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE
Definition: cdrw_hw.h:1312
_Null_terminated_ char * NTSTRSAFE_PSTR
Definition: ntstrsafe.h:56
#define SCSIOP_RECOVER_BUF_DATA
Definition: cdrw_hw.h:890
#define SCSIOP_WRITE_VERIFY
Definition: cdrw_hw.h:911
#define SCSI_SENSE_NO_SENSE
Definition: cdrw_hw.h:1187
#define SRB_STATUS_INVALID_LUN
Definition: srb.h:354
#define InterlockedExchange
Definition: armddk.h:54
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define SCSIOP_RECEIVE_DIAGNOSTIC
Definition: cdrw_hw.h:900
#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED
Definition: cdrw_hw.h:1321
#define SCSIOP_MECHANISM_STATUS
Definition: cdrw_hw.h:966
#define SCSIOP_PAUSE_RESUME
Definition: cdrw_hw.h:935
#define _In_
Definition: no_sal2.h:204
#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED
Definition: cdrw_hw.h:1314
#define DBGGETADSENSECODESTR(_pSrb)
Definition: debug.h:29
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED
Definition: cdrw_hw.h:1324
#define IOCTL_STORAGE_RESET_BUS
Definition: ntddstor.h:126
#define SCSIOP_READ_POSITION
Definition: cdrw_hw.h:917
#define IOCTL_STORAGE_PREDICT_FAILURE
Definition: ntddstor.h:135
#define SCSI_ADSENSE_POSITION_ERROR
Definition: cdrw_hw.h:1222
#define SCSIOP_REQUEST_BLOCK_ADDR
Definition: cdrw_hw.h:869
#define IOCTL_STORAGE_GET_MEDIA_TYPES
Definition: ntddstor.h:120
#define InterlockedIncrement
Definition: armddk.h:53
#define DPFLTR_ERROR_LEVEL
Definition: main.cpp:32
unsigned short USHORT
Definition: pedump.c:61
#define SRB_STATUS_TIMEOUT
Definition: srb.h:341
#define _In_z_
Definition: no_sal2.h:239
#define SCSIOP_BLANK
Definition: cdrw_hw.h:950
FORCEINLINE PVOID SrbGetSenseInfoBuffer(_In_ PVOID Srb)
Definition: srbhelper.h:619
struct _CDB::_CDB6GENERIC CDB6GENERIC
#define SCSIOP_PERSISTENT_RESERVE_OUT
Definition: scsi.h:329
#define IOCTL_STORAGE_LOAD_MEDIA
Definition: ntddstor.h:99
#define DBGGETSRBSTATUSSTR(_pSrb)
Definition: debug.h:27
#define SCSIOP_SEEK_BLOCK
Definition: cdrw_hw.h:882
unsigned int * PULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
#define va_start(ap, A)
Definition: acmsvcex.h:91
char * DbgGetAdditionalSenseCodeQualifierStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:882
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define SCSIOP_GET_CONFIGURATION
Definition: cdrw_hw.h:930
#define SCSIOP_COPY_COMPARE
Definition: cdrw_hw.h:920
#define SCSIOP_INIT_ELEMENT_STATUS
Definition: scsi.h:240
__inline PCDB ClasspTransferPacketGetCdb(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2445
#define SCSIOP_READ_CAPACITY
Definition: cdrw_hw.h:904
#define SCSIOP_READ_DVD_STRUCTURE
Definition: cdrw_hw.h:960
KIRQL irql
Definition: wave.h:1
#define SCSI_SENSEQ_AUTHENTICATION_FAILURE
Definition: cdrw_hw.h:1390
#define SCSIOP_LOG_SELECT
Definition: cdrw_hw.h:936
PUCHAR BufPtrCopy
Definition: classp.h:562
#define SCSI_SENSEQ_WRITE_PROTECT_ENABLE
Definition: scsi.h:879
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
#define SCSI_SENSE_RESERVED
Definition: cdrw_hw.h:1202
#define SCSI_ADSENSE_INVALID_LUN
Definition: cdrw_hw.h:1266
NTSYSAPI USHORT NTAPI RtlCaptureStackBackTrace(_In_ ULONG FramesToSkip, _In_ ULONG FramesToCapture, _Out_writes_to_(FramesToCapture, return) PVOID *BackTrace, _Out_opt_ PULONG BackTraceHash)
#define SCSI_ADSENSE_TRACK_ERROR
Definition: cdrw_hw.h:1231
#define ClasspInitializeDebugGlobals()
Definition: debug.h:123
unsigned int ULONG
Definition: retypes.h:1
#define SRB_STATUS_UNEXPECTED_BUS_FREE
Definition: srb.h:350
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define SCSI_SENSE_DATA_PROTECT
Definition: cdrw_hw.h:1194
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
#define SCSIOP_READ_CD
Definition: cdrw_hw.h:967
#define SCSIOP_REQUEST_SENSE
Definition: cdrw_hw.h:870
#define SRB_STATUS_INVALID_PATH_ID
Definition: srb.h:339
#define SCSIOP_COMPARE
Definition: cdrw_hw.h:919
enum _CLASS_DEBUG_LEVEL CLASS_DEBUG_LEVEL
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
#define SCSI_SENSE_ILLEGAL_REQUEST
Definition: cdrw_hw.h:1192
#define SCSI_ADSENSE_ILLEGAL_COMMAND
Definition: cdrw_hw.h:1263
char * DbgGetAdditionalSenseCodeStr(PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: debug.c:826
#define SCSIOP_SET_READ_AHEAD
Definition: cdrw_hw.h:955
#define MAKE_CASE(ioctlCode)
#define SCSIOP_SET_LIMITS
Definition: cdrw_hw.h:916
#define SCSIOP_PLAY_CD
Definition: scsi.h:410
#define SCSIOP_MODE_SELECT10
Definition: cdrw_hw.h:943
static SERVICE_STATUS status
Definition: service.c:31
#define SCSIOP_READ_ELEMENT_STATUS
Definition: scsi.h:404
#define SCSI_SENSEQ_DESTINATION_FULL
Definition: scsi.h:810
#define SCSIOP_CLOSE_TRACK_SESSION
Definition: cdrw_hw.h:947
#define SCSI_SENSEQ_WRITE_PROTECT_DISABLE
Definition: scsi.h:880
#define SCSIOP_VERIFY6
Definition: cdrw_hw.h:889
#define SCSIOP_START_STOP_UNIT
Definition: cdrw_hw.h:897
base of all file and directory entries
Definition: entries.h:82
#define SCSI_SENSEQ_FILEMARK_DETECTED
Definition: cdrw_hw.h:1438
#define SCSIOP_SEND_DIAGNOSTIC
Definition: cdrw_hw.h:901
#define SCSI_SENSE_UNIT_ATTENTION
Definition: cdrw_hw.h:1193
#define SCSIOP_SEND_DVD_STRUCTURE
Definition: cdrw_hw.h:969
#define SCSI_ADSENSE_INVALID_CDB
Definition: cdrw_hw.h:1265
#define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR
Definition: cdrw_hw.h:1395
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
ULONG BufLenCopy
Definition: classp.h:563
#define SCSIOP_COPY
Definition: cdrw_hw.h:894
#define SCSIOP_LOG_SENSE
Definition: cdrw_hw.h:937
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG __cdecl DbgPrintEx(IN ULONG ComponentId, IN ULONG Level, IN PCCH Format,...)
Definition: debug.c:228
BOOLEAN validSense
Definition: scsi.h:4017
#define SCSI_ADSENSE_MEDIUM_CHANGED
Definition: cdrw_hw.h:1288
#define SCSIOP_MODE_SELECT
Definition: cdrw_hw.h:891
#define SCSIOP_PARTITION
Definition: cdrw_hw.h:883
#define NT_ASSERT
Definition: rtlfuncs.h:3312
Definition: ps.c:97