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