Advertisement
MagicAndre1981

new drive health notification in Windows 10 RS1 (14267 SDK)

Feb 24th, 2016
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ioevent.h:
  2.  
  3. //
  4. // This notification may be sent by storage drivers to
  5. // alert other components of changes in the health status
  6. // of a device. A component that registers for this
  7. // custom PNP notification should query for the
  8. // StorageDeviceManagementStatus property to learn
  9. // more about the device's health status.
  10. //
  11.  
  12. // {0F1BD644-3916-49C5-B063-991940118FB2}
  13. DEFINE_GUID( GUID_IO_DISK_HEALTH_NOTIFICATION, 0xf1bd644, 0x3916, 0x49c5, 0xb0, 0x63, 0x99, 0x19, 0x40, 0x11, 0x8f, 0xb2);
  14.  
  15. typedef struct _DISK_HEALTH_NOTIFICATION_DATA {
  16.  
  17.     //
  18.     // The GUID of the device reporting the health change.
  19.     // This is the same GUID returned by IOCTL_STORAGE_GET_DEVICE_NUMBER_EX.
  20.     //
  21.     GUID  DeviceGuid;
  22.  
  23. } DISK_HEALTH_NOTIFICATION_DATA, *PDISK_HEALTH_NOTIFICATION_DATA;
  24.  
  25.  
  26.  
  27. ntddstor.h:
  28.  
  29.  
  30. //
  31. // Constants for StorageDeviceManagementStatus
  32. //
  33.  
  34. typedef enum _STORAGE_DISK_HEALTH_STATUS {
  35.     DiskHealthUnknown = 0,
  36.     DiskHealthUnhealthy,
  37.     DiskHealthWarning,
  38.     DiskHealthHealthy,
  39.     DiskHealthMax
  40. } STORAGE_DISK_HEALTH_STATUS, *PSTORAGE_DISK_HEALTH_STATUS;
  41.  
  42. //
  43. // Operational States
  44. //
  45. typedef enum _STORAGE_DISK_OPERATIONAL_STATUS {  
  46.     DiskOpStatusNone = 0,
  47.     DiskOpStatusUnknown,
  48.     DiskOpStatusOk,
  49.     DiskOpStatusPredictingFailure,
  50.     DiskOpStatusInService,
  51.     DiskOpStatusHardwareError,
  52.     DiskOpStatusNotUsable,
  53.     DiskOpStatusTransientError,
  54.     DiskOpStatusMissing,
  55. } STORAGE_DISK_OPERATIONAL_STATUS, *PSTORAGE_DISK_OPERATIONAL_STATUS;  
  56.  
  57. //
  58. // Operational Reasons
  59. //
  60. typedef enum _STORAGE_OPERATIONAL_STATUS_REASON {
  61.     DiskOpReasonUnknown = 0,
  62.     DiskOpReasonScsiSenseCode,
  63.     DiskOpReasonMedia,
  64.     DiskOpReasonIo,
  65.     DiskOpReasonThresholdExceeded,
  66.     DiskOpReasonLostData,
  67.     DiskOpReasonEnergySource,
  68.     DiskOpReasonConfiguration,
  69.     DiskOpReasonDeviceController,
  70.     DiskOpReasonMediaController,
  71.     DiskOpReasonComponent,
  72.     DiskOpReasonNVDIMM_N,
  73.     DiskOpReasonBackgroundOperation,
  74.     DiskOpReasonInvalidFirmware
  75. } STORAGE_OPERATIONAL_STATUS_REASON, *PSTORAGE_OPERATIONAL_STATUS_REASON;
  76.  
  77. typedef struct _STORAGE_OPERATIONAL_REASON {
  78.     ULONG Version;
  79.     ULONG Size;
  80.     STORAGE_OPERATIONAL_STATUS_REASON Reason;
  81.    
  82.     union {
  83.    
  84.         //
  85.         // This is the format if Reason == DiskOpReasonScsiSenseCode.
  86.         //
  87.         struct {
  88.             UCHAR SenseKey;
  89.             UCHAR ASC;
  90.             UCHAR ASCQ;
  91.             UCHAR Reserved;
  92.         } ScsiSenseKey;
  93.        
  94.         //
  95.         // This is the format if Reason == DiskOpReasonNVDIMM_N.
  96.         //
  97.         struct {
  98.             UCHAR CriticalHealth;
  99.             UCHAR ModuleHealth[2];
  100.             UCHAR ErrorThresholdStatus;
  101.         } NVDIMM_N;
  102.  
  103.         ULONG AsUlong;
  104.     } RawBytes;
  105. } STORAGE_OPERATIONAL_REASON, *PSTORAGE_OPERATIONAL_REASON;
  106.  
  107. //
  108. // Output buffer for StorageDeviceManagementStatus & PropertyStandardQuery
  109. //
  110.  
  111. #define STORAGE_DEVICE_MAX_OPERATIONAL_STATUS    16
  112.  
  113. typedef _Struct_size_bytes_(Size) struct _STORAGE_DEVICE_MANAGEMENT_STATUS {
  114.  
  115.     //
  116.     // Sizeof() of this structure serves
  117.     // as the version.
  118.     //
  119.  
  120.     ULONG Version;
  121.  
  122.     //
  123.     // The total size of the structure, including operational status reasons
  124.     // that didn't fit in the caller's array. Callers should use this field to learn
  125.     // how big the input buffer should be to contain all the available information.
  126.     //
  127.  
  128.     ULONG Size;
  129.  
  130.     //
  131.     // Health status.
  132.     //
  133.  
  134.     STORAGE_DISK_HEALTH_STATUS Health;
  135.  
  136.     //
  137.     // The number of operational status returned.
  138.     //
  139.  
  140.     ULONG NumberOfOperationalStatus;
  141.  
  142.     //
  143.     // The number of additional reasons returned.
  144.     //
  145.  
  146.     ULONG NumberOfAdditionalReasons;
  147.  
  148.     //
  149.     // Operational statuses. The primary operational status is the first element
  150.     // in the array. There are NumberOfOperationalStatus valid elements in the array.
  151.     //
  152.  
  153.     STORAGE_DISK_OPERATIONAL_STATUS OperationalStatus[STORAGE_DEVICE_MAX_OPERATIONAL_STATUS];
  154.  
  155.     //
  156.     // Additional reasons. There are NumberOfAdditionalReasons valid elements in the array.
  157.     //
  158.  
  159.     _Field_size_(NumberOfAdditionalReasons) STORAGE_OPERATIONAL_REASON AdditionalReasons[ANYSIZE_ARRAY];
  160.  
  161. } STORAGE_DEVICE_MANAGEMENT_STATUS, *PSTORAGE_DEVICE_MANAGEMENT_STATUS;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement