source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ntdddisk.h@ 1181

Last change on this file since 1181 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 18.4 KB
RevLine 
[1166]1/*
2 * ntdddisk.h
3 *
4 * Disk IOCTL interface.
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23#ifndef _NTDDDISK_H_
24#define _NTDDDISK_H_
25
26#include "ntddstor.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#define DD_DISK_DEVICE_NAME "\\Device\\UNKNOWN"
33#define DD_DISK_DEVICE_NAME_U L"\\Device\\UNKNOWN"
34
35#define IOCTL_DISK_BASE FILE_DEVICE_DISK
36
37#define IOCTL_DISK_CHECK_VERIFY \
38 CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
39
40#define IOCTL_DISK_CONTROLLER_NUMBER \
41 CTL_CODE(IOCTL_DISK_BASE, 0x0011, METHOD_BUFFERED, FILE_ANY_ACCESS)
42
43#define IOCTL_DISK_CREATE_DISK \
44 CTL_CODE(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
45
46#define IOCTL_DISK_DELETE_DRIVE_LAYOUT \
47 CTL_CODE(IOCTL_DISK_BASE, 0x0040, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
48
49#define IOCTL_DISK_FIND_NEW_DEVICES \
50 CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
51
52#define IOCTL_DISK_FORMAT_TRACKS \
53 CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
54
55#define IOCTL_DISK_FORMAT_TRACKS_EX \
56 CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
57
58#define IOCTL_DISK_GET_CACHE_INFORMATION \
59 CTL_CODE(IOCTL_DISK_BASE, 0x0035, METHOD_BUFFERED, FILE_READ_ACCESS)
60
61#define IOCTL_DISK_GET_DRIVE_GEOMETRY \
62 CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
63
64#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX \
65 CTL_CODE(IOCTL_DISK_BASE, 0x0028, METHOD_BUFFERED, FILE_ANY_ACCESS)
66
67#define IOCTL_DISK_GET_DRIVE_LAYOUT \
68 CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
69
70#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX \
71 CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS)
72
73#define IOCTL_DISK_GET_MEDIA_TYPES \
74 CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
75
76#define IOCTL_DISK_GET_LENGTH_INFO \
77 CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS)
78
79#define IOCTL_DISK_GET_PARTITION_INFO \
80 CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
81
82#define IOCTL_DISK_GET_PARTITION_INFO_EX \
83 CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS)
84
85#define IOCTL_DISK_GROW_PARTITION \
86 CTL_CODE(IOCTL_DISK_BASE, 0x0034, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
87
88#define IOCTL_DISK_HISTOGRAM_STRUCTURE \
89 CTL_CODE(IOCTL_DISK_BASE, 0x000c, METHOD_BUFFERED, FILE_ANY_ACCESS)
90
91#define IOCTL_DISK_HISTOGRAM_DATA \
92 CTL_CODE(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, FILE_ANY_ACCESS)
93
94#define IOCTL_DISK_HISTOGRAM_RESET \
95 CTL_CODE(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, FILE_ANY_ACCESS)
96
97#define IOCTL_DISK_INTERNAL_CLEAR_VERIFY \
98 CTL_CODE(IOCTL_DISK_BASE, 0x0101, METHOD_NEITHER, FILE_ANY_ACCESS)
99
100#define IOCTL_DISK_INTERNAL_SET_VERIFY \
101 CTL_CODE(IOCTL_DISK_BASE, 0x0100, METHOD_NEITHER, FILE_ANY_ACCESS)
102
103#define IOCTL_DISK_IS_WRITABLE \
104 CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
105
106#define IOCTL_DISK_LOGGING \
107 CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
108
109#define IOCTL_DISK_PERFORMANCE \
110 CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
111
112#define IOCTL_DISK_PERFORMANCE_OFF \
113 CTL_CODE(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, FILE_ANY_ACCESS)
114
115#define IOCTL_DISK_REASSIGN_BLOCKS \
116 CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
117
118#define IOCTL_DISK_REQUEST_DATA \
119 CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
120
121#define IOCTL_DISK_REQUEST_STRUCTURE \
122 CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
123
124#define IOCTL_DISK_MEDIA_REMOVAL \
125 CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
126
127#define IOCTL_DISK_EJECT_MEDIA \
128 CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
129
130#define IOCTL_DISK_LOAD_MEDIA \
131 CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
132
133#define IOCTL_DISK_RESERVE \
134 CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
135
136#define IOCTL_DISK_RELEASE \
137 CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
138
139#define IOCTL_DISK_FIND_NEW_DEVICES \
140 CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
141
142#define IOCTL_DISK_SET_CACHE_INFORMATION \
143 CTL_CODE(IOCTL_DISK_BASE, 0x0036, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
144
145#define IOCTL_DISK_SET_DRIVE_LAYOUT \
146 CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
147
148#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX \
149 CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
150
151#define IOCTL_DISK_SET_PARTITION_INFO \
152 CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
153
154#define IOCTL_DISK_SET_PARTITION_INFO_EX \
155 CTL_CODE(IOCTL_DISK_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
156
157#define IOCTL_DISK_UPDATE_DRIVE_SIZE \
158 CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
159
160#define IOCTL_DISK_VERIFY \
161 CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
162
163#define SMART_GET_VERSION \
164 CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
165
166#define SMART_RCV_DRIVE_DATA \
167 CTL_CODE(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
168
169#define SMART_SEND_DRIVE_COMMAND \
170 CTL_CODE(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
171
172#define IOCTL_DISK_UPDATE_PROPERTIES \
173 CTL_CODE(IOCTL_DISK_BASE, 0x50, METHOD_BUFFERED, FILE_ANY_ACCESS)
174
175#define PARTITION_ENTRY_UNUSED 0x00
176#define PARTITION_FAT_12 0x01
177#define PARTITION_XENIX_1 0x02
178#define PARTITION_XENIX_2 0x03
179#define PARTITION_FAT_16 0x04
180#define PARTITION_EXTENDED 0x05
181#define PARTITION_HUGE 0x06
182#define PARTITION_IFS 0x07
183#define PARTITION_OS2BOOTMGR 0x0A
184#define PARTITION_FAT32 0x0B
185#define PARTITION_FAT32_XINT13 0x0C
186#define PARTITION_XINT13 0x0E
187#define PARTITION_XINT13_EXTENDED 0x0F
188#define PARTITION_PREP 0x41
189#define PARTITION_LDM 0x42
190#define PARTITION_UNIX 0x63
191#define VALID_NTFT 0xC0
192#define PARTITION_NTFT 0x80
193
194#define IsFTPartition( PartitionType ) \
195 (((PartitionType) & PARTITION_NTFT) && \
196 IsRecognizedPartition(PartitionType))
197
198#define IsContainerPartition(PartitionType) \
199 (((PartitionType) == PARTITION_EXTENDED) || \
200 ((PartitionType) == PARTITION_XINT13_EXTENDED))
201
202#define IsRecognizedPartition(PartitionType) ( \
203 (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT_12)) || \
204 (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_HUGE)) || \
205 (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_IFS)) || \
206 (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32)) || \
207 (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32_XINT13)) || \
208 (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_XINT13)) || \
209 ((PartitionType) == PARTITION_FAT_12) || \
210 ((PartitionType) == PARTITION_FAT_16) || \
211 ((PartitionType) == PARTITION_HUGE) || \
212 ((PartitionType) == PARTITION_IFS) || \
213 ((PartitionType) == PARTITION_FAT32) || \
214 ((PartitionType) == PARTITION_FAT32_XINT13) || \
215 ((PartitionType) == PARTITION_XINT13))
216
217#define WMI_DISK_GEOMETRY_GUID \
218 {0x25007f51, 0x57c2, 0x11d1, {0xa5, 0x28, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10}}
219
220typedef USHORT BAD_TRACK_NUMBER;
221typedef USHORT *PBAD_TRACK_NUMBER;
222
223typedef enum _MEDIA_TYPE {
224 Unknown,
225 F5_1Pt2_512,
226 F3_1Pt44_512,
227 F3_2Pt88_512,
228 F3_20Pt8_512,
229 F3_720_512,
230 F5_360_512,
231 F5_320_512,
232 F5_320_1024,
233 F5_180_512,
234 F5_160_512,
235 RemovableMedia,
236 FixedMedia,
237 F3_120M_512,
238 F3_640_512,
239 F5_640_512,
240 F5_720_512,
241 F3_1Pt2_512,
242 F3_1Pt23_1024,
243 F5_1Pt23_1024,
244 F3_128Mb_512,
245 F3_230Mb_512,
246 F8_256_128
247} MEDIA_TYPE, *PMEDIA_TYPE;
248
249typedef enum _DETECTION_TYPE {
250 DetectNone,
251 DetectInt13,
252 DetectExInt13
253} DETECTION_TYPE;
254
255typedef struct _DISK_CONTROLLER_NUMBER {
256 ULONG ControllerNumber;
257 ULONG DiskNumber;
258} DISK_CONTROLLER_NUMBER, *PDISK_CONTROLLER_NUMBER;
259
260typedef struct _DISK_INT13_INFO {
261 USHORT DriveSelect;
262 ULONG MaxCylinders;
263 USHORT SectorsPerTrack;
264 USHORT MaxHeads;
265 USHORT NumberDrives;
266} DISK_INT13_INFO, *PDISK_INT13_INFO;
267
268typedef struct _DISK_EX_INT13_INFO {
269 USHORT ExBufferSize;
270 USHORT ExFlags;
271 ULONG ExCylinders;
272 ULONG ExHeads;
273 ULONG ExSectorsPerTrack;
274 ULONG64 ExSectorsPerDrive;
275 USHORT ExSectorSize;
276 USHORT ExReserved;
277} DISK_EX_INT13_INFO, *PDISK_EX_INT13_INFO;
278
279typedef struct _DISK_DETECTION_INFO {
280 ULONG SizeOfDetectInfo;
281 DETECTION_TYPE DetectionType;
282 _ANONYMOUS_UNION union {
283 _ANONYMOUS_STRUCT struct {
284 DISK_INT13_INFO Int13;
285 DISK_EX_INT13_INFO ExInt13;
286 } DUMMYSTRUCTNAME;
287 } DUMMYUNIONNAME;
288} DISK_DETECTION_INFO, *PDISK_DETECTION_INFO;
289
290typedef struct _DISK_GEOMETRY {
291 LARGE_INTEGER Cylinders;
292 MEDIA_TYPE MediaType;
293 ULONG TracksPerCylinder;
294 ULONG SectorsPerTrack;
295 ULONG BytesPerSector;
296} DISK_GEOMETRY, *PDISK_GEOMETRY;
297
298typedef struct _DISK_GEOMETRY_EX {
299 DISK_GEOMETRY Geometry;
300 LARGE_INTEGER DiskSize;
301 UCHAR Data[1];
302} DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX;
303
304#define DiskGeometryGetPartition(Geometry) \
305 ((PDISK_PARTITION_INFO)((Geometry) + 1))
306
307#define DiskGeometryGetDetect(Geometry)\
308 ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \
309 DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
310
311typedef struct _PARTITION_INFORMATION {
312 LARGE_INTEGER StartingOffset;
313 LARGE_INTEGER PartitionLength;
314 ULONG HiddenSectors;
315 ULONG PartitionNumber;
316 UCHAR PartitionType;
317 BOOLEAN BootIndicator;
318 BOOLEAN RecognizedPartition;
319 BOOLEAN RewritePartition;
320} PARTITION_INFORMATION, *PPARTITION_INFORMATION;
321
322typedef struct _PARTITION_INFORMATION_GPT {
323 GUID PartitionType;
324 GUID PartitionId;
325 ULONG64 Attributes;
326 WCHAR Name [36];
327} PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
328
329typedef enum _PARTITION_STYLE {
330 PARTITION_STYLE_MBR,
331 PARTITION_STYLE_GPT,
332 PARTITION_STYLE_RAW
333} PARTITION_STYLE;
334
335typedef struct _DISK_PARTITION_INFO {
336 ULONG SizeOfPartitionInfo;
337 PARTITION_STYLE PartitionStyle;
338 _ANONYMOUS_UNION union {
339 struct {
340 ULONG Signature;
341 ULONG CheckSum;
342 } Mbr;
343 struct {
344 GUID DiskId;
345 } Gpt;
346 } DUMMYUNIONNAME;
347} DISK_PARTITION_INFO, *PDISK_PARTITION_INFO;
348
349typedef struct _DISK_PERFORMANCE {
350 LARGE_INTEGER BytesRead;
351 LARGE_INTEGER BytesWritten;
352 LARGE_INTEGER ReadTime;
353 LARGE_INTEGER WriteTime;
354 LARGE_INTEGER IdleTime;
355 ULONG ReadCount;
356 ULONG WriteCount;
357 ULONG QueueDepth;
358 ULONG SplitCount;
359 LARGE_INTEGER QueryTime;
360 ULONG StorageDeviceNumber;
361 WCHAR StorageManagerName[8];
362} DISK_PERFORMANCE, *PDISK_PERFORMANCE;
363
364typedef struct _PARTITION_INFORMATION_MBR {
365 UCHAR PartitionType;
366 BOOLEAN BootIndicator;
367 BOOLEAN RecognizedPartition;
368 ULONG HiddenSectors;
369#if NTDDI_VERSION > NTDDI_WINBLUE
370 GUID PartitionId;
371#endif
372} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
373
374typedef struct _PARTITION_INFORMATION_EX {
375 PARTITION_STYLE PartitionStyle;
376 LARGE_INTEGER StartingOffset;
377 LARGE_INTEGER PartitionLength;
378 ULONG PartitionNumber;
379 BOOLEAN RewritePartition;
380#if NTDDI_VERSION >= NTDDI_WIN10_RS3
381 BOOLEAN IsServicePartition;
382#endif
383 _ANONYMOUS_UNION union {
384 PARTITION_INFORMATION_MBR Mbr;
385 PARTITION_INFORMATION_GPT Gpt;
386 } DUMMYUNIONNAME;
387} PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
388
389typedef struct _DRIVE_LAYOUT_INFORMATION {
390 ULONG PartitionCount;
391 ULONG Signature;
392 PARTITION_INFORMATION PartitionEntry[1];
393} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
394
395typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
396 ULONG Signature;
397} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
398
399typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
400 GUID DiskId;
401 LARGE_INTEGER StartingUsableOffset;
402 LARGE_INTEGER UsableLength;
403 ULONG MaxPartitionCount;
404} DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
405
406typedef struct _DRIVE_LAYOUT_INFORMATION_EX {
407 ULONG PartitionStyle;
408 ULONG PartitionCount;
409 __GNU_EXTENSION union {
410 DRIVE_LAYOUT_INFORMATION_MBR Mbr;
411 DRIVE_LAYOUT_INFORMATION_GPT Gpt;
412 };
413 PARTITION_INFORMATION_EX PartitionEntry[1];
414} DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX;
415
416typedef struct _FORMAT_EX_PARAMETERS {
417 MEDIA_TYPE MediaType;
418 ULONG StartCylinderNumber;
419 ULONG EndCylinderNumber;
420 ULONG StartHeadNumber;
421 ULONG EndHeadNumber;
422 USHORT FormatGapLength;
423 USHORT SectorsPerTrack;
424 USHORT SectorNumber[1];
425} FORMAT_EX_PARAMETERS, *PFORMAT_EX_PARAMETERS;
426
427typedef struct _FORMAT_PARAMETERS {
428 MEDIA_TYPE MediaType;
429 ULONG StartCylinderNumber;
430 ULONG EndCylinderNumber;
431 ULONG StartHeadNumber;
432 ULONG EndHeadNumber;
433} FORMAT_PARAMETERS, *PFORMAT_PARAMETERS;
434
435typedef struct _GET_LENGTH_INFORMATION {
436 LARGE_INTEGER Length;
437} GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION;
438
439typedef struct _REASSIGN_BLOCKS {
440 USHORT Reserved;
441 USHORT Count;
442 ULONG BlockNumber[1];
443} REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
444
445typedef struct _SET_PARTITION_INFORMATION {
446 UCHAR PartitionType;
447} SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
448
449typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
450typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
451
452typedef struct _SET_PARTITION_INFORMATION_EX {
453 PARTITION_STYLE PartitionStyle;
454 _ANONYMOUS_UNION union {
455 SET_PARTITION_INFORMATION_MBR Mbr;
456 SET_PARTITION_INFORMATION_GPT Gpt;
457 } DUMMYUNIONNAME;
458} SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX;
459
460typedef struct _VERIFY_INFORMATION {
461 LARGE_INTEGER StartingOffset;
462 ULONG Length;
463} VERIFY_INFORMATION, *PVERIFY_INFORMATION;
464
465typedef enum {
466 EqualPriority,
467 KeepPrefetchedData,
468 KeepReadData
469} DISK_CACHE_RETENTION_PRIORITY;
470
471typedef struct _DISK_CACHE_INFORMATION {
472 BOOLEAN ParametersSavable;
473 BOOLEAN ReadCacheEnabled;
474 BOOLEAN WriteCacheEnabled;
475 DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
476 DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
477 USHORT DisablePrefetchTransferLength;
478 BOOLEAN PrefetchScalar;
479 _ANONYMOUS_UNION union {
480 struct {
481 USHORT Minimum;
482 USHORT Maximum;
483 USHORT MaximumBlocks;
484 } ScalarPrefetch;
485 struct {
486 USHORT Minimum;
487 USHORT Maximum;
488 } BlockPrefetch;
489 } DUMMYUNIONNAME;
490} DISK_CACHE_INFORMATION, *PDISK_CACHE_INFORMATION;
491
492typedef struct _DISK_GROW_PARTITION {
493 ULONG PartitionNumber;
494 LARGE_INTEGER BytesToGrow;
495} DISK_GROW_PARTITION, *PDISK_GROW_PARTITION;
496
497/* GETVERSIONINPARAMS.fCapabilities constants */
498#define CAP_ATA_ID_CMD 1
499#define CAP_ATAPI_ID_CMD 2
500#define CAP_SMART_CMD 4
501
502typedef struct _GETVERSIONINPARAMS {
503 UCHAR bVersion;
504 UCHAR bRevision;
505 UCHAR bReserved;
506 UCHAR bIDEDeviceMap;
507 ULONG fCapabilities;
508 ULONG dwReserved[4];
509} GETVERSIONINPARAMS, *PGETVERSIONINPARAMS, *LPGETVERSIONINPARAMS;
510
511/* IDEREGS.bCommandReg constants */
512#define ATAPI_ID_CMD 0xA1
513#define ID_CMD 0xEC
514#define SMART_CMD 0xB0
515
516#define SMART_CYL_LOW 0x4F
517#define SMART_CYL_HI 0xC2
518
519typedef struct _IDEREGS {
520 UCHAR bFeaturesReg;
521 UCHAR bSectorCountReg;
522 UCHAR bSectorNumberReg;
523 UCHAR bCylLowReg;
524 UCHAR bCylHighReg;
525 UCHAR bDriveHeadReg;
526 UCHAR bCommandReg;
527 UCHAR bReserved;
528} IDEREGS, *PIDEREGS, *LPIDEREGS;
529
530#include <pshpack1.h>
531typedef struct _SENDCMDINPARAMS {
532 ULONG cBufferSize;
533 IDEREGS irDriveRegs;
534 UCHAR bDriveNumber;
535 UCHAR bReserved[3];
536 ULONG dwReserved[4];
537 UCHAR bBuffer[1];
538} SENDCMDINPARAMS, *PSENDCMDINPARAMS, *LPSENDCMDINPARAMS;
539#include <poppack.h>
540
541/* DRIVERSTATUS.bDriverError constants */
542#define SMART_NO_ERROR 0
543#define SMART_IDE_ERROR 1
544#define SMART_INVALID_FLAG 2
545#define SMART_INVALID_COMMAND 3
546#define SMART_INVALID_BUFFER 4
547#define SMART_INVALID_DRIVE 5
548#define SMART_INVALID_IOCTL 6
549#define SMART_ERROR_NO_MEM 7
550#define SMART_INVALID_REGISTER 8
551#define SMART_NOT_SUPPORTED 9
552#define SMART_NO_IDE_DEVICE 10
553
554#define SMART_OFFLINE_ROUTINE_OFFLINE 0
555#define SMART_SHORT_SELFTEST_OFFLINE 1
556#define SMART_EXTENDED_SELFTEST_OFFLINE 2
557#define SMART_ABORT_OFFLINE_SELFTEST 127
558#define SMART_SHORT_SELFTEST_CAPTIVE 129
559#define SMART_EXTENDED_SELFTEST_CAPTIVE 130
560
561typedef struct _DRIVERSTATUS {
562 UCHAR bDriverError;
563 UCHAR bIDEError;
564 UCHAR bReserved[2];
565 ULONG dwReserved[2];
566} DRIVERSTATUS, *PDRIVERSTATUS, *LPDRIVERSTATUS;
567
568#define READ_ATTRIBUTE_BUFFER_SIZE 512
569#define IDENTIFY_BUFFER_SIZE 512
570#define READ_THRESHOLD_BUFFER_SIZE 512
571#define SMART_LOG_SECTOR_SIZE 512
572
573#include <pshpack1.h>
574typedef struct _SENDCMDOUTPARAMS {
575 ULONG cBufferSize;
576 DRIVERSTATUS DriverStatus;
577 UCHAR bBuffer[1];
578} SENDCMDOUTPARAMS, *PSENDCMDOUTPARAMS, *LPSENDCMDOUTPARAMS;
579#include <poppack.h>
580
581#define READ_ATTRIBUTES 0xD0
582#define READ_THRESHOLDS 0xD1
583#define ENABLE_DISABLE_AUTOSAVE 0xD2
584#define SAVE_ATTRIBUTE_VALUES 0xD3
585#define EXECUTE_OFFLINE_DIAGS 0xD4
586#define SMART_READ_LOG 0xD5
587#define SMART_WRITE_LOG 0xd6
588#define ENABLE_SMART 0xD8
589#define DISABLE_SMART 0xD9
590#define RETURN_SMART_STATUS 0xDA
591#define ENABLE_DISABLE_AUTO_OFFLINE 0xDB
592
593typedef struct _MAPPED_ADDRESS {
594 struct _MAPPED_ADDRESS *NextMappedAddress;
595 PVOID MappedAddress;
596 ULONG NumberOfBytes;
597 LARGE_INTEGER IoAddress;
598 ULONG BusNumber;
599} MAPPED_ADDRESS, *PMAPPED_ADDRESS;
600
601
602#ifdef __cplusplus
603}
604#endif
605
606#endif /* _NTDDDISK_H_ */
Note: See TracBrowser for help on using the repository browser.