?? winioctl.h
字號(hào):
WORD Reserved;
WORD Count;
DWORD BlockNumber[1];
} REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
#if(_WIN32_WINNT >= 0x0400)
//
// IOCTL_DISK_CONTROLLER_NUMBER returns the controller and disk
// number for the handle. This is used to determine if a disk
// is attached to the primary or secondary IDE controller.
//
typedef struct _DISK_CONTROLLER_NUMBER {
DWORD ControllerNumber;
DWORD DiskNumber;
} DISK_CONTROLLER_NUMBER, *PDISK_CONTROLLER_NUMBER;
#endif /* _WIN32_WINNT >= 0x0400 */
///////////////////////////////////////////////////////
// //
// The following structures define disk performance //
// statistics: specifically the locations of all the //
// reads and writes which have occured on the disk. //
// //
// To use these structures, you must issue an IOCTL_ //
// DISK_HIST_STRUCTURE (with a DISK_HISTOGRAM) to //
// obtain the basic histogram information. The //
// number of buckets which must allocated is part of //
// this structure. Allocate the required number of //
// buckets and call an IOCTL_DISK_HIST_DATA to fill //
// in the data //
// //
///////////////////////////////////////////////////////
#define HIST_NO_OF_BUCKETS 24
typedef struct _HISTOGRAM_BUCKET {
DWORD Reads;
DWORD Writes;
} HISTOGRAM_BUCKET, *PHISTOGRAM_BUCKET;
#define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET)
typedef struct _DISK_HISTOGRAM {
LARGE_INTEGER DiskSize;
LARGE_INTEGER Start;
LARGE_INTEGER End;
LARGE_INTEGER Average;
LARGE_INTEGER AverageRead;
LARGE_INTEGER AverageWrite;
DWORD Granularity;
DWORD Size;
DWORD ReadCount;
DWORD WriteCount;
PHISTOGRAM_BUCKET Histogram;
} DISK_HISTOGRAM, *PDISK_HISTOGRAM;
#define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM)
///////////////////////////////////////////////////////
// //
// The following structures define disk debugging //
// capabilities. The IOCTLs are directed to one of //
// the two disk filter drivers. //
// //
// DISKPERF is a utilty for collecting disk request //
// statistics. //
// //
// SIMBAD is a utility for injecting faults in //
// IO requests to disks. //
// //
///////////////////////////////////////////////////////
//
// The following structure is exchanged on an IOCTL_DISK_GET_PERFORMANCE
// request. This ioctl collects summary disk request statistics used
// in measuring performance.
//
typedef struct _DISK_PERFORMANCE {
LARGE_INTEGER BytesRead;
LARGE_INTEGER BytesWritten;
LARGE_INTEGER ReadTime;
LARGE_INTEGER WriteTime;
DWORD ReadCount;
DWORD WriteCount;
DWORD QueueDepth;
} DISK_PERFORMANCE, *PDISK_PERFORMANCE;
//
// This structure defines the disk logging record. When disk logging
// is enabled, one of these is written to an internal buffer for each
// disk request.
//
typedef struct _DISK_RECORD {
LARGE_INTEGER ByteOffset;
LARGE_INTEGER StartTime;
LARGE_INTEGER EndTime;
PVOID VirtualAddress;
DWORD NumberOfBytes;
BYTE DeviceNumber;
BOOLEAN ReadRequest;
} DISK_RECORD, *PDISK_RECORD;
//
// The following structure is exchanged on an IOCTL_DISK_LOG request.
// Not all fields are valid with each function type.
//
typedef struct _DISK_LOGGING {
BYTE Function;
PVOID BufferAddress;
DWORD BufferSize;
} DISK_LOGGING, *PDISK_LOGGING;
//
// Disk logging functions
//
// Start disk logging. Only the Function and BufferSize fields are valid.
//
#define DISK_LOGGING_START 0
//
// Stop disk logging. Only the Function field is valid.
//
#define DISK_LOGGING_STOP 1
//
// Return disk log. All fields are valid. Data will be copied from internal
// buffer to buffer specified for the number of bytes requested.
//
#define DISK_LOGGING_DUMP 2
//
// DISK BINNING
//
// DISKPERF will keep counters for IO that falls in each of these ranges.
// The application determines the number and size of the ranges.
// Joe Lin wanted me to keep it flexible as possible, for instance, IO
// sizes are interesting in ranges like 0-4096, 4097-16384, 16385-65536, 65537+.
//
#define DISK_BINNING 3
//
// Bin types
//
typedef enum _BIN_TYPES {
RequestSize,
RequestLocation
} BIN_TYPES;
//
// Bin ranges
//
typedef struct _BIN_RANGE {
LARGE_INTEGER StartValue;
LARGE_INTEGER Length;
} BIN_RANGE, *PBIN_RANGE;
//
// Bin definition
//
typedef struct _PERF_BIN {
DWORD NumberOfBins;
DWORD TypeOfBin;
BIN_RANGE BinsRanges[1];
} PERF_BIN, *PPERF_BIN ;
//
// Bin count
//
typedef struct _BIN_COUNT {
BIN_RANGE BinRange;
DWORD BinCount;
} BIN_COUNT, *PBIN_COUNT;
//
// Bin results
//
typedef struct _BIN_RESULTS {
DWORD NumberOfBins;
BIN_COUNT BinCounts[1];
} BIN_RESULTS, *PBIN_RESULTS;
#if(_WIN32_WINNT >= 0x0400)
//
// Data structures for SMART drive fault prediction.
//
// GETVERSIONINPARAMS contains the data returned from the
// Get Driver Version function.
//
#pragma pack(1)
typedef struct _GETVERSIONINPARAMS {
BYTE bVersion; // Binary driver version.
BYTE bRevision; // Binary driver revision.
BYTE bReserved; // Not used.
BYTE bIDEDeviceMap; // Bit map of IDE devices.
DWORD fCapabilities; // Bit mask of driver capabilities.
DWORD dwReserved[4]; // For future use.
} GETVERSIONINPARAMS, *PGETVERSIONINPARAMS, *LPGETVERSIONINPARAMS;
#pragma pack()
//
// Bits returned in the fCapabilities member of GETVERSIONINPARAMS
//
#define CAP_ATA_ID_CMD 1 // ATA ID command supported
#define CAP_ATAPI_ID_CMD 2 // ATAPI ID command supported
#define CAP_SMART_CMD 4 // SMART commannds supported
//
// IDE registers
//
#pragma pack(1)
typedef struct _IDEREGS {
BYTE bFeaturesReg; // Used for specifying SMART "commands".
BYTE bSectorCountReg; // IDE sector count register
BYTE bSectorNumberReg; // IDE sector number register
BYTE bCylLowReg; // IDE low order cylinder value
BYTE bCylHighReg; // IDE high order cylinder value
BYTE bDriveHeadReg; // IDE drive/head register
BYTE bCommandReg; // Actual IDE command.
BYTE bReserved; // reserved for future use. Must be zero.
} IDEREGS, *PIDEREGS, *LPIDEREGS;
#pragma pack()
//
// Valid values for the bCommandReg member of IDEREGS.
//
#define ATAPI_ID_CMD 0xA1 // Returns ID sector for ATAPI.
#define ID_CMD 0xEC // Returns ID sector for ATA.
#define SMART_CMD 0xB0 // Performs SMART cmd.
// Requires valid bFeaturesReg,
// bCylLowReg, and bCylHighReg
//
// Cylinder register defines for SMART command
//
#define SMART_CYL_LOW 0x4F
#define SMART_CYL_HI 0xC2
//
// SENDCMDINPARAMS contains the input parameters for the
// Send Command to Drive function.
//
#pragma pack(1)
typedef struct _SENDCMDINPARAMS {
DWORD cBufferSize; // Buffer size in bytes
IDEREGS irDriveRegs; // Structure with drive register values.
BYTE bDriveNumber; // Physical drive number to send
// command to (0,1,2,3).
BYTE bReserved[3]; // Reserved for future expansion.
DWORD dwReserved[4]; // For future use.
BYTE bBuffer[1]; // Input buffer.
} SENDCMDINPARAMS, *PSENDCMDINPARAMS, *LPSENDCMDINPARAMS;
#pragma pack()
//
// Status returned from driver
//
#pragma pack(1)
typedef struct _DRIVERSTATUS {
BYTE bDriverError; // Error code from driver,
// or 0 if no error.
BYTE bIDEError; // Contents of IDE Error register.
// Only valid when bDriverError
// is SMART_IDE_ERROR.
BYTE bReserved[2]; // Reserved for future expansion.
DWORD dwReserved[2]; // Reserved for future expansion.
} DRIVERSTATUS, *PDRIVERSTATUS, *LPDRIVERSTATUS;
#pragma pack()
//
// bDriverError values
//
#define SMART_NO_ERROR 0 // No error
#define SMART_IDE_ERROR 1 // Error from IDE controller
#define SMART_INVALID_FLAG 2 // Invalid command flag
#define SMART_INVALID_COMMAND 3 // Invalid command byte
#define SMART_INVALID_BUFFER 4 // Bad buffer (null, invalid addr..)
#define SMART_INVALID_DRIVE 5 // Drive number not valid
#define SMART_INVALID_IOCTL 6 // Invalid IOCTL
#define SMART_ERROR_NO_MEM 7 // Could not lock user's buffer
#define SMART_INVALID_REGISTER 8 // Some IDE Register not valid
#define SMART_NOT_SUPPORTED 9 // Invalid cmd flag set
#define SMART_NO_IDE_DEVICE 10 // Cmd issued to device not present
// although drive number is valid
#pragma pack(1)
typedef struct _SENDCMDOUTPARAMS {
DWORD cBufferSize; // Size of bBuffer in bytes
DRIVERSTATUS DriverStatus; // Driver status structure.
BYTE bBuffer[1]; // Buffer of arbitrary length in which to store the data read from the // drive.
} SENDCMDOUTPARAMS, *PSENDCMDOUTPARAMS, *LPSENDCMDOUTPARAMS;
#pragma pack()
#define READ_ATTRIBUTE_BUFFER_SIZE 512
#define IDENTIFY_BUFFER_SIZE 512
#define READ_THRESHOLD_BUFFER_SIZE 512
//
// Feature register defines for SMART "sub commands"
//
#define READ_ATTRIBUTES 0xD0
#define READ_THRESHOLDS 0xD1
#define ENABLE_DISABLE_AUTOSAVE 0xD2
#define SAVE_ATTRIBUTE_VALUES 0xD3
#define EXECUTE_OFFLINE_DIAGS 0xD4
#define ENABLE_SMART 0xD8
#define DISABLE_SMART 0xD9
#define RETURN_SMART_STATUS 0xDA
#endif /* _WIN32_WINNT >= 0x0400 */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -