📄 ntdddisk.inc
字号:
BYTE ? ; pad
; Contains the minimum and maximum amount of data which will be
; will be prefetched into the cache on a disk operation. This value
; may either be a scalar multiplier of the transfer length of the request,
; or an abolute number of disk blocks. PrefetchScalar (above) indicates
; which interpretation is used.
union ; 010h
struct ScalarPrefetch
Minimum WORD ?
Maximum WORD ?
; The maximum number of blocks which will be prefetched - useful
; with the scalar limits to set definite upper limits.
MaximumBlocks WORD ?
WORD ? ; pad
ends ; ScalarPrefetch
struct BlockPrefetch
Minimum WORD ?
Maximum WORD ?
ends ; BlockPrefetch
ends
DISK_CACHE_INFORMATION ENDS
PDISK_CACHE_INFORMATION typedef ptr DISK_CACHE_INFORMATION
; IOCTL_DISK_GROW_PARTITION will update the size of a partition
; by adding sectors to the length. The number of sectors must be
; predetermined by examining PARTITION_INFORMATION.
DISK_GROW_PARTITION STRUCT
PartitionNumber DWORD ?
DWORD ? ; pad
BytesToGrow LARGE_INTEGER <>
DISK_GROW_PARTITION ENDS
PDISK_GROW_PARTITION typedef ptr DISK_GROW_PARTITION
;#endif /* _WIN32_WINNT >= 0x0500 */
;::::::::::::::::::::::::::::::::::::::::::::::::::::::
;: ::
;: 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 ::
;: ::
;::::::::::::::::::::::::::::::::::::::::::::::::::::::
HIST_NO_OF_BUCKETS equ 24
HISTOGRAM_BUCKET STRUCT
Reads DWORD ?
Writes DWORD ?
HISTOGRAM_BUCKET ENDS
PHISTOGRAM_BUCKET typedef ptr HISTOGRAM_BUCKET
HISTOGRAM_BUCKET_SIZE equ (sizeof HISTOGRAM_BUCKET)
DISK_HISTOGRAM STRUCT ; sizeof = 48h
DiskSize LARGE_INTEGER <>
_Start LARGE_INTEGER <> ; original Start
_End LARGE_INTEGER <> ; original End
Average LARGE_INTEGER <>
AverageRead LARGE_INTEGER <>
AverageWrite LARGE_INTEGER <>
Granularity DWORD ?
_Size DWORD ? ; original Size
ReadCount DWORD ?
WriteCount DWORD ?
Histogram DWORD ? ; PHISTOGRAM_BUCKET
DISK_HISTOGRAM ENDS
PDISK_HISTOGRAM typedef ptr DISK_HISTOGRAM
DISK_HISTOGRAM_SIZE equ (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.
DISK_PERFORMANCE STRUCT ; sizeof = 58h
BytesRead LARGE_INTEGER <>
BytesWritten LARGE_INTEGER <>
ReadTime LARGE_INTEGER <>
WriteTime LARGE_INTEGER <>
IdleTime LARGE_INTEGER <>
ReadCount DWORD ?
WriteCount DWORD ?
QueueDepth DWORD ?
SplitCount DWORD ?
QueryTime LARGE_INTEGER <>
StorageDeviceNumber DWORD ?
StorageManagerName WORD 8 dup(?) ; WCHAR
WORD ? ; padding
WORD ?
DISK_PERFORMANCE ENDS
PDISK_PERFORMANCE typedef ptr DISK_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.
DISK_RECORD STRUCT ; sizeof = 28h
ByteOffset LARGE_INTEGER <>
StartTime LARGE_INTEGER <>
EndTime LARGE_INTEGER <>
VirtualAddress PVOID ?
NumberOfBytes DWORD ?
DeviceNumber BYTE ? ; UCHAR
ReadRequest BOOLEAN ?
db 6 dup(?) ; padding
DISK_RECORD ENDS
PDISK_RECORD typedef ptr DISK_RECORD
; The following structure is exchanged on an IOCTL_DISK_LOG request.
; Not all fields are valid with each function type.
DISK_LOGGING STRUCT ; sizeof = 12
Function BYTE ? ; UCHAR
db 3 dup(?)
BufferAddress PVOID ?
BufferSize DWORD ?
DISK_LOGGING ENDS
PDISK_LOGGING typedef ptr DISK_LOGGING
; +
; Disk logging functions
;
; Start disk logging. Only the Function and BufferSize fields are valid.
; -
DISK_LOGGING_START equ 0
; Stop disk logging. Only the Function field is valid.
DISK_LOGGING_STOP equ 1
; Return disk log. All fields are valid. Data will be copied from internal
; buffer to buffer specified for the number of bytes requested.
DISK_LOGGING_DUMP equ 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+.
; -
DISK_BINNING equ 3
; Bin types
;typedef enum _BIN_TYPES {
RequestSize equ 0
RequestLocation equ 1
; Bin ranges
BIN_RANGE STRUCT ; sizeof = 10h
StartValue LARGE_INTEGER <>
_Length LARGE_INTEGER <> ; Original Length
BIN_RANGE ENDS
PBIN_RANGE typedef ptr BIN_RANGE
; Bin definition
PERF_BIN STRUCT ; sizeof = 18h
NumberOfBins DWORD ?
TypeOfBin DWORD ?
BinsRanges BIN_RANGE 1 dup(<>)
PERF_BIN ENDS
PPERF_BIN typedef ptr PERF_BIN
; Bin count
BIN_COUNT STRUCT ; sizeof = 18h
BinRange BIN_RANGE <>
BinCount DWORD ?
BIN_COUNT ENDS
PBIN_COUNT typedef ptr BIN_COUNT
; Bin results
BIN_RESULTS STRUCT ; sizeof =
NumberOfBins DWORD ?
BinCounts BIN_COUNT 1 dup(<>)
DWORD ? ; padding
DWORD ?
BIN_RESULTS ENDS
PBIN_RESULTS typedef ptr BIN_RESULTS
;#if(_WIN32_WINNT >= 0x0400)
; +
; Data structures for SMART drive fault prediction.
;
; GETVERSIONINPARAMS contains the data returned from the
; Get Driver Version function.
; -
GETVERSIONINPARAMS STRUCT ; sizeof = 18
bVersion BYTE ? ; Binary driver version.
bRevision BYTE ? ; Binary driver revision.
bReserved BYTE ? ; Not used.
bIDEDeviceMap BYTE ? ; Bit map of IDE devices.
fCapabilities BYTE ? ; Bit mask of driver capabilities.
dwReserved DWORD 4 dup(?) ; For future use.
GETVERSIONINPARAMS ENDS
PGETVERSIONINPARAMS typedef ptr GETVERSIONINPARAMS
LPGETVERSIONINPARAMS typedef ptr GETVERSIONINPARAMS
; Bits returned in the fCapabilities member of GETVERSIONINPARAMS
CAP_ATA_ID_CMD equ 1 ; ATA ID command supported
CAP_ATAPI_ID_CMD equ 2 ; ATAPI ID command supported
CAP_SMART_CMD equ 4 ; SMART commannds supported
; IDE registers
IDEREGS STRUCT ; sizeof = 8
bFeaturesReg BYTE ? ; Used for specifying SMART "commands".
bSectorCountReg BYTE ? ; IDE sector count register
bSectorNumberReg BYTE ? ; IDE sector number register
bCylLowReg BYTE ? ; IDE low order cylinder value
bCylHighReg BYTE ? ; IDE high order cylinder value
bDriveHeadReg BYTE ? ; IDE drive/head register
bCommandReg BYTE ? ; Actual IDE command.
bReserved BYTE ? ; reserved for future use. Must be zero.
IDEREGS ENDS
PIDEREGS typedef ptr IDEREGS
LPIDEREGS typedef ptr IDEREGS
; Valid values for the bCommandReg member of IDEREGS.
ATAPI_ID_CMD equ 0A1h ; Returns ID sector for ATAPI.
ID_CMD equ 0ECh ; Returns ID sector for ATA.
SMART_CMD equ 0B0h ; Performs SMART cmd.
; Requires valid bFeaturesReg,
; bCylLowReg, and bCylHighReg
; Cylinder register defines for SMART command
SMART_CYL_LOW equ 04Fh
SMART_CYL_HI equ 0C2h
; SENDCMDINPARAMS contains the input parameters for the
; Send Command to Drive function.
SENDCMDINPARAMS STRUCT ; sizeof = 21h
cBufferSize DWORD ? ; Buffer size in bytes
irDriveRegs IDEREGS <> ; Structure with drive register values.
bDriveNumber BYTE ? ; Physical drive number to send
; command to (0,1,2,3).
bReserved BYTE 3 dup(?) ; Reserved for future expansion.
dwReserved DWORD 4 dup(?) ; For future use.
bBuffer BYTE 1 dup(?) ; Input buffer.
SENDCMDINPARAMS ENDS
PSENDCMDINPARAMS typedef ptr SENDCMDINPARAMS
LPSENDCMDINPARAMS typedef ptr SENDCMDINPARAMS
; Status returned from driver
DRIVERSTATUS STRUCT ; sizeof = 0Ch
bDriverError BYTE ? ; Error code from driver, or 0 if no error.
bIDEError BYTE ? ; Contents of IDE Error register.
; Only valid when bDriverError
; is SMART_IDE_ERROR.
bReserved BYTE 2 dup(?) ; Reserved for future expansion.
dwReserved DWORD 2 dup(?) ; Reserved for future expansion.
DRIVERSTATUS ENDS
PDRIVERSTATUS typedef ptr DRIVERSTATUS
LPDRIVERSTATUS typedef ptr DRIVERSTATUS
; bDriverError values
SMART_NO_ERROR equ 0 ; No error
SMART_IDE_ERROR equ 1 ; Error from IDE controller
SMART_INVALID_FLAG equ 2 ; Invalid command flag
SMART_INVALID_COMMAND equ 3 ; Invalid command byte
SMART_INVALID_BUFFER equ 4 ; Bad buffer (null, invalid addr..)
SMART_INVALID_DRIVE equ 5 ; Drive number not valid
SMART_INVALID_IOCTL equ 6 ; Invalid IOCTL
SMART_ERROR_NO_MEM equ 7 ; Could not lock user's buffer
SMART_INVALID_REGISTER equ 8 ; Some IDE Register not valid
SMART_NOT_SUPPORTED equ 9 ; Invalid cmd flag set
SMART_NO_IDE_DEVICE equ 10 ; Cmd issued to device not present
; although drive number is valid
SENDCMDOUTPARAMS STRUCT ; sizeof = 11h
cBufferSize DWORD ? ; Size of bBuffer in bytes
DriverStatus DRIVERSTATUS <> ; Driver status structure.
bBuffer BYTE 1 dup(?) ; Buffer of arbitrary length in which to store the data read from the drive.
SENDCMDOUTPARAMS ENDS
PSENDCMDOUTPARAMS typedef ptr SENDCMDOUTPARAMS
LPSENDCMDOUTPARAMS typedef ptr SENDCMDOUTPARAMS
READ_ATTRIBUTE_BUFFER_SIZE equ 512
IDENTIFY_BUFFER_SIZE equ 512
READ_THRESHOLD_BUFFER_SIZE equ 512
; Feature register defines for SMART "sub commands"
READ_ATTRIBUTES equ 0D0h
READ_THRESHOLDS equ 0D1h
ENABLE_DISABLE_AUTOSAVE equ 0D2h
SAVE_ATTRIBUTE_VALUES equ 0D3h
EXECUTE_OFFLINE_DIAGS equ 0D4h
ENABLE_SMART equ 0D8h
DISABLE_SMART equ 0D9h
RETURN_SMART_STATUS equ 0DAh
ENABLE_DISABLE_AUTO_OFFLINE equ 0DBh
;#endif /* _WIN32_WINNT >= 0x0400 */
; end_winioctl
; The following device control code is for the SIMBAD simulated bad
; sector facility. See SIMBAD.H in this directory for related structures.
IOCTL_DISK_SIMBAD equ CTL_CODE(IOCTL_DISK_BASE, 0400h, METHOD_BUFFERED, FILE_READ_ACCESS + FILE_WRITE_ACCESS)
; Queue link for mapped addresses stored for unmapping.
MAPPED_ADDRESS STRUCT ; sizeof = 20h
NextMappedAddress PVOID ? ; PTR MAPPED_ADDRESS
MappedAddress PVOID ?
NumberOfBytes DWORD ?
DWORD ? ; padding
IoAddress LARGE_INTEGER <>
BusNumber DWORD ?
MAPPED_ADDRESS ENDS
PMAPPED_ADDRESS typedef ptr MAPPED_ADDRESS
ENDIF ; _NTDDDISK_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -