Advertisement
Guest User

Jason

a guest
Mar 15th, 2008
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. #ifndef __CSMART_h__
  2. #define __CSMART_h__
  3.  
  4. #include <windows.h>
  5. #include <string>
  6.  
  7. using std::string;
  8.  
  9.  
  10. // ATA ID command response; structure memory alignment set to 1 so
  11. // we can grab this straight from the response buffer.
  12. #pragma pack (push, 1)
  13. struct ATA_ID_SECTOR {
  14.    USHORT  wGenConfig;
  15.    USHORT  wNumCyls;
  16.    USHORT  wReserved;
  17.    USHORT  wNumHeads;
  18.    USHORT  wBytesPerTrack;
  19.    USHORT  wBytesPerSector;
  20.    USHORT  wSectorsPerTrack;
  21.    USHORT  wVendorUnique[3];
  22.    CHAR    sSerialNumber[20]; // <-- not a c-style string (see source)
  23.    USHORT  wBufferType;
  24.    USHORT  wBufferSize;
  25.    USHORT  wECCSize;
  26.    CHAR    sFirmwareRev[8];   // <-- not a c-style string (see source)
  27.    CHAR    sModelNumber[40];  // <-- not a c-style string (see source)
  28.    USHORT  wMoreVendorUnique;
  29.    USHORT  wDoubleWordIO;
  30.    USHORT  wCapabilities;
  31.    USHORT  wReserved1;
  32.    USHORT  wPIOTiming;
  33.    USHORT  wDMATiming;
  34.    USHORT  wBS;
  35.    USHORT  wNumCurrentCyls;
  36.    USHORT  wNumCurrentHeads;
  37.    USHORT  wNumCurrentSectorsPerTrack;
  38.    ULONG   ulCurrentSectorCapacity;
  39.    USHORT  wMultSectorStuff;
  40.    ULONG   ulTotalAddressableSectors;
  41.    USHORT  wSingleWordDMA;
  42.    USHORT  wMultiWordDMA;
  43.    BYTE    bReserved[128];
  44. };
  45. #pragma pack (pop)
  46.  
  47.  
  48. class CSMART {
  49.  
  50. public:
  51.  
  52.     CSMART (unsigned drive_index) throw (string);
  53.     ~CSMART (void);
  54.  
  55.     void dump (void) const;
  56.  
  57. private:
  58.  
  59.     string             _filename;
  60.     unsigned           _dindex;
  61.     HANDLE             _hdrive;
  62.     GETVERSIONINPARAMS _verinfo;
  63.     ATA_ID_SECTOR      _ataid;
  64.     string             _ataid_serial;
  65.     string             _ataid_model;
  66.     string             _ataid_firmware;
  67.  
  68.     void _enableSMART (void) throw (string);
  69.  
  70. };
  71.  
  72.  
  73. #endif
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement