ReactOS  0.4.15-dev-425-gc40b086
ntdddisk.h
Go to the documentation of this file.
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_INTERNAL_SET_NOTIFY \
113  CTL_CODE(IOCTL_DISK_BASE, 0x0102, METHOD_BUFFERED, FILE_ANY_ACCESS)
114 
115 #define IOCTL_DISK_IS_WRITABLE \
116  CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
117 
118 #define IOCTL_DISK_LOGGING \
119  CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
120 
121 #define IOCTL_DISK_PERFORMANCE \
122  CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
123 
124 #define IOCTL_DISK_PERFORMANCE_OFF \
125  CTL_CODE(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, FILE_ANY_ACCESS)
126 
127 #define IOCTL_DISK_REASSIGN_BLOCKS \
128  CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
129 
130 #define IOCTL_DISK_REQUEST_DATA \
131  CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
132 
133 #define IOCTL_DISK_REQUEST_STRUCTURE \
134  CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
135 
136 #define IOCTL_DISK_MEDIA_REMOVAL \
137  CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
138 
139 #define IOCTL_DISK_EJECT_MEDIA \
140  CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
141 
142 #define IOCTL_DISK_LOAD_MEDIA \
143  CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
144 
145 #define IOCTL_DISK_RESERVE \
146  CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
147 
148 #define IOCTL_DISK_RELEASE \
149  CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
150 
151 #define IOCTL_DISK_FIND_NEW_DEVICES \
152  CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
153 
154 #define IOCTL_DISK_SET_CACHE_INFORMATION \
155  CTL_CODE(IOCTL_DISK_BASE, 0x0036, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
156 
157 //
158 // NTDDI_WIN2003 was an older define used in the early beta builds, which
159 // Microsoft forgot to fix in a few headers.
160 // NTDDI_WS03 is the correct term.
161 //
162 #if (NTDDI_VERSION < NTDDI_WS03)
163 #define IOCTL_DISK_GET_WRITE_CACHE_STATE \
164  CTL_CODE(IOCTL_DISK_BASE, 0x0037, METHOD_BUFFERED, FILE_READ_ACCESS)
165 #else
166 #define OBSOLETE_DISK_GET_WRITE_CACHE_STATE \
167  CTL_CODE(IOCTL_DISK_BASE, 0x0037, METHOD_BUFFERED, FILE_READ_ACCESS)
168 #endif
169 
170 #define IOCTL_DISK_SET_DRIVE_LAYOUT \
171  CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
172 
173 #define IOCTL_DISK_SET_DRIVE_LAYOUT_EX \
174  CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
175 
176 #define IOCTL_DISK_SET_PARTITION_INFO \
177  CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
178 
179 #define IOCTL_DISK_SET_PARTITION_INFO_EX \
180  CTL_CODE(IOCTL_DISK_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
181 
182 #define IOCTL_DISK_UPDATE_DRIVE_SIZE \
183  CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
184 
185 #define IOCTL_DISK_VERIFY \
186  CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
187 
188 #define IOCTL_DISK_COPY_DATA \
189  CTL_CODE(IOCTL_DISK_BASE, 0x0019, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
190 
191 #define IOCTL_DISK_SIMBAD \
192  CTL_CODE(IOCTL_DISK_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
193 
194 #define SMART_GET_VERSION \
195  CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
196 
197 #define SMART_RCV_DRIVE_DATA \
198  CTL_CODE(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
199 
200 #define SMART_SEND_DRIVE_COMMAND \
201  CTL_CODE(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
202 
203 #if(_WIN32_WINNT >= 0x0500)
204 #define IOCTL_DISK_UPDATE_DRIVE_SIZE CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
205 #define IOCTL_DISK_GROW_PARTITION CTL_CODE(IOCTL_DISK_BASE, 0x0034, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
206 #define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE, 0x0035, METHOD_BUFFERED, FILE_READ_ACCESS)
207 #define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE, 0x0036, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
208 #define IOCTL_DISK_DELETE_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE, 0x0040, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
209 #define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE, 0x0050, METHOD_BUFFERED, FILE_ANY_ACCESS)
210 #define IOCTL_DISK_FORMAT_DRIVE CTL_CODE(IOCTL_DISK_BASE, 0x00f3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
211 #define IOCTL_DISK_SENSE_DEVICE CTL_CODE(IOCTL_DISK_BASE, 0x00f8, METHOD_BUFFERED, FILE_ANY_ACCESS)
212 #endif
213 
214 #define PARTITION_ENTRY_UNUSED 0x00
215 #define PARTITION_FAT_12 0x01
216 #define PARTITION_XENIX_1 0x02
217 #define PARTITION_XENIX_2 0x03
218 #define PARTITION_FAT_16 0x04
219 #define PARTITION_EXTENDED 0x05
220 #define PARTITION_HUGE 0x06
221 #define PARTITION_IFS 0x07
222 #define PARTITION_OS2BOOTMGR 0x0A
223 #define PARTITION_FAT32 0x0B
224 #define PARTITION_FAT32_XINT13 0x0C
225 #define PARTITION_XINT13 0x0E
226 #define PARTITION_XINT13_EXTENDED 0x0F
227 #define PARTITION_PREP 0x41
228 #define PARTITION_LDM 0x42
229 #define PARTITION_UNIX 0x63
230 #define VALID_NTFT 0xC0
231 #define PARTITION_NTFT 0x80
232 #ifdef __REACTOS__
233 #define PARTITION_OLD_LINUX 0x43
234 #define PARTITION_LINUX 0x83
235 #define PARTITION_ISO9660 0x96
236 #define PARTITION_FREEBSD 0xA5
237 #define PARTITION_OPENBSD 0xA6
238 #define PARTITION_NETBSD 0xA9
239 #endif
240 
241 #define IsFTPartition( PartitionType ) \
242  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT_12)) || \
243  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_HUGE)) || \
244  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_IFS)) || \
245  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32)) || \
246  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32_XINT13)) || \
247  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_XINT13))
248 
249 
250 #define IsContainerPartition(PartitionType) \
251  (((PartitionType) == PARTITION_EXTENDED) || \
252  ((PartitionType) == PARTITION_XINT13_EXTENDED))
253 
254 #ifdef __REACTOS__
255 #define IsRecognizedPartition(PartitionType) ( \
256  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT_12)) || \
257  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_HUGE)) || \
258  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_IFS)) || \
259  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32)) || \
260  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32_XINT13)) || \
261  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_XINT13)) || \
262  ((PartitionType) == PARTITION_FAT_12) || \
263  ((PartitionType) == PARTITION_FAT_16) || \
264  ((PartitionType) == PARTITION_HUGE) || \
265  ((PartitionType) == PARTITION_IFS) || \
266  ((PartitionType) == PARTITION_FAT32) || \
267  ((PartitionType) == PARTITION_FAT32_XINT13) || \
268  ((PartitionType) == PARTITION_XINT13) || \
269  ((PartitionType) == PARTITION_LINUX) || \
270  ((PartitionType) == PARTITION_OLD_LINUX) || \
271  ((PartitionType) == PARTITION_ISO9660) || \
272  ((PartitionType) == PARTITION_FREEBSD) || \
273  ((PartitionType) == PARTITION_OPENBSD) || \
274  ((PartitionType) == PARTITION_NETBSD))
275 #else
276 #define IsRecognizedPartition(PartitionType) ( \
277  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT_12)) || \
278  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_HUGE)) || \
279  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_IFS)) || \
280  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32)) || \
281  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32_XINT13)) || \
282  (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_XINT13)) || \
283  ((PartitionType) == PARTITION_FAT_12) || \
284  ((PartitionType) == PARTITION_FAT_16) || \
285  ((PartitionType) == PARTITION_HUGE) || \
286  ((PartitionType) == PARTITION_IFS) || \
287  ((PartitionType) == PARTITION_FAT32) || \
288  ((PartitionType) == PARTITION_FAT32_XINT13) || \
289  ((PartitionType) == PARTITION_XINT13))
290 #endif
291 
292 #if(_WIN32_WINNT >= 0x0500)
293 #define GPT_ATTRIBUTE_PLATFORM_REQUIRED 0x00000001
294 #define GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY 0x10000000
295 #define GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY 0x20000000
296 #define GPT_BASIC_DATA_ATTRIBUTE_HIDDEN 0x40000000
297 #define GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER 0x80000000
298 #endif
299 
300 #define WMI_DISK_GEOMETRY_GUID \
301  {0x25007f51, 0x57c2, 0x11d1, {0xa5, 0x28, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10}}
302 
305 
306 typedef enum _MEDIA_TYPE {
334 
335 typedef enum _DETECTION_TYPE {
340 
341 typedef struct _DISK_CONTROLLER_NUMBER {
345 
346 typedef struct _DISK_INT13_INFO {
353 
354 typedef struct _DISK_EX_INT13_INFO {
364 
365 typedef struct _DISK_DETECTION_INFO {
368  _ANONYMOUS_UNION union {
369  _ANONYMOUS_STRUCT struct {
372  } DUMMYSTRUCTNAME;
373  } DUMMYUNIONNAME;
375 
376 typedef struct _DISK_GEOMETRY {
383 
384 typedef struct _DISK_GEOMETRY_EX {
389 
390 #if (NTDDI_VERSION < NTDDI_WS03)
391 #define DiskGeometryGetPartition(Geometry) \
392  ((PDISK_PARTITION_INFO)((Geometry) + 1))
393 
394 #define DiskGeometryGetDetect(Geometry)\
395  ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \
396  DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
397 #else
398 #define DiskGeometryGetPartition(Geometry) \
399  ((PDISK_PARTITION_INFO)((Geometry)->Data))
400 
401 #define DiskGeometryGetDetect(Geometry)\
402  ((PDISK_DETECTION_INFO)(((ULONG_PTR)DiskGeometryGetPartition(Geometry) + \
403  DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
404 #endif
405 
406 typedef struct _PARTITION_INFORMATION {
416 
417 typedef struct _PARTITION_INFORMATION_GPT {
421  WCHAR Name [36];
423 
424 typedef enum _PARTITION_STYLE {
428 #ifdef __REACTOS__
429  /* ReactOS custom partition handlers */
430  PARTITION_STYLE_BRFR = 128 /* Xbox-BRFR partitioning scheme */
431 #endif
433 
434 typedef struct _DISK_PARTITION_INFO {
437  _ANONYMOUS_UNION union {
438  struct {
441  } Mbr;
442  struct {
444  } Gpt;
445  } DUMMYUNIONNAME;
447 
448 typedef struct _DISK_PERFORMANCE {
462 
463 typedef struct _PARTITION_INFORMATION_MBR {
469 
470 typedef struct _PARTITION_INFORMATION_EX {
476 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3)
478 #endif
479  _ANONYMOUS_UNION union {
482  } DUMMYUNIONNAME;
484 
490 
494 
501 
505  __GNU_EXTENSION union {
508  };
511 
512 typedef struct _FORMAT_EX_PARAMETERS {
522 
523 typedef struct _FORMAT_PARAMETERS {
530 
531 typedef struct _GET_LENGTH_INFORMATION {
534 
535 typedef struct _REASSIGN_BLOCKS {
540 
544 
547 
550  _ANONYMOUS_UNION union {
553  } DUMMYUNIONNAME;
555 
556 typedef struct _VERIFY_INFORMATION {
560 
561 /* GETVERSIONINPARAMS.fCapabilities constants */
562 #define CAP_ATA_ID_CMD 1
563 #define CAP_ATAPI_ID_CMD 2
564 #define CAP_SMART_CMD 4
565 
566 typedef struct _GETVERSIONINPARAMS {
574 
575 /* IDEREGS.bCommandReg constants */
576 #define ATAPI_ID_CMD 0xA1
577 #define ID_CMD 0xEC
578 #define SMART_CMD 0xB0
579 
580 #define SMART_CYL_LOW 0x4F
581 #define SMART_CYL_HI 0xC2
582 
583 typedef struct _IDEREGS {
593 
594 #include <pshpack1.h>
595 typedef struct _SENDCMDINPARAMS {
599  UCHAR bReserved[3];
600  ULONG dwReserved[4];
601  UCHAR bBuffer[1];
603 #include <poppack.h>
604 
605 /* DRIVERSTATUS.bDriverError constants */
606 #define SMART_NO_ERROR 0
607 #define SMART_IDE_ERROR 1
608 #define SMART_INVALID_FLAG 2
609 #define SMART_INVALID_COMMAND 3
610 #define SMART_INVALID_BUFFER 4
611 #define SMART_INVALID_DRIVE 5
612 #define SMART_INVALID_IOCTL 6
613 #define SMART_ERROR_NO_MEM 7
614 #define SMART_INVALID_REGISTER 8
615 #define SMART_NOT_SUPPORTED 9
616 #define SMART_NO_IDE_DEVICE 10
617 
618 #define SMART_OFFLINE_ROUTINE_OFFLINE 0
619 #define SMART_SHORT_SELFTEST_OFFLINE 1
620 #define SMART_EXTENDED_SELFTEST_OFFLINE 2
621 #define SMART_ABORT_OFFLINE_SELFTEST 127
622 #define SMART_SHORT_SELFTEST_CAPTIVE 129
623 #define SMART_EXTENDED_SELFTEST_CAPTIVE 130
624 
625 typedef struct _DRIVERSTATUS {
628  UCHAR bReserved[2];
629  ULONG dwReserved[2];
631 
632 #define READ_ATTRIBUTE_BUFFER_SIZE 512
633 #define IDENTIFY_BUFFER_SIZE 512
634 #define READ_THRESHOLD_BUFFER_SIZE 512
635 #define SMART_LOG_SECTOR_SIZE 512
636 
637 #include <pshpack1.h>
638 typedef struct _SENDCMDOUTPARAMS {
641  UCHAR bBuffer[1];
643 #include <poppack.h>
644 
645 #define READ_ATTRIBUTES 0xD0
646 #define READ_THRESHOLDS 0xD1
647 #define ENABLE_DISABLE_AUTOSAVE 0xD2
648 #define SAVE_ATTRIBUTE_VALUES 0xD3
649 #define EXECUTE_OFFLINE_DIAGS 0xD4
650 #define SMART_READ_LOG 0xD5
651 #define SMART_WRITE_LOG 0xd6
652 #define ENABLE_SMART 0xD8
653 #define DISABLE_SMART 0xD9
654 #define RETURN_SMART_STATUS 0xDA
655 #define ENABLE_DISABLE_AUTO_OFFLINE 0xDB
656 
657 typedef struct _MAPPED_ADDRESS {
664 
665 
666 
667 #if(_WIN32_WINNT >= 0x0500)
668 
669 typedef struct _CREATE_DISK_GPT
670 {
671  GUID DiskId;
672  ULONG MaxPartitionCount;
674 
675 typedef struct _CREATE_DISK_MBR
676 {
679 
680 
681 typedef struct _CREATE_DISK
682 {
683  PARTITION_STYLE PartitionStyle;
684  union {
685  CREATE_DISK_MBR Mbr;
686  CREATE_DISK_GPT Gpt;
687  };
689 
690 
691 typedef enum {
696 
697 typedef enum _DISK_WRITE_CACHE_STATE {
698  DiskWriteCacheNormal,
699  DiskWriteCacheForceDisable,
700  DiskWriteCacheDisableNotSupported
701 } DISK_WRITE_CACHE_STATE, *PDISK_WRITE_CACHE_STATE;
702 
703 
704 typedef struct _DISK_CACHE_INFORMATION
705 {
713  union {
714  struct {
715  USHORT Minimum;
716  USHORT Maximum;
718  } ScalarPrefetch;
719 
720  struct {
721  USHORT Minimum;
722  USHORT Maximum;
723  } BlockPrefetch;
724  };
725 
727 
728 typedef struct _DISK_GROW_PARTITION {
732 #endif
733 
734 
735 #ifdef __cplusplus
736 }
737 #endif
738 
739 #endif /* _NTDDDISK_H_ */
_ANONYMOUS_UNION union _DISK_DETECTION_INFO::@3073 DUMMYUNIONNAME
ULONG cBufferSize
Definition: helper.h:31
ULONG64 ExSectorsPerDrive
Definition: ntdddisk.h:360
UCHAR bReserved
Definition: helper.h:16
LARGE_INTEGER PartitionLength
Definition: ntdddisk.h:408
struct _DISK_EX_INT13_INFO * PDISK_EX_INT13_INFO
struct CREATE_DISK_MBR * PCREATE_DISK_MBR
struct _VERIFY_INFORMATION VERIFY_INFORMATION
struct _DRIVERSTATUS * PDRIVERSTATUS
_ANONYMOUS_UNION union _SET_PARTITION_INFORMATION_EX::@3081 DUMMYUNIONNAME
UCHAR bSectorNumberReg
Definition: helper.h:11
struct _SET_PARTITION_INFORMATION_EX * PSET_PARTITION_INFORMATION_EX
struct _DRIVE_LAYOUT_INFORMATION_GPT * PDRIVE_LAYOUT_INFORMATION_GPT
struct _DISK_PARTITION_INFO::@3075::@3077 Gpt
DETECTION_TYPE DetectionType
Definition: ntdddisk.h:367
struct _DISK_PERFORMANCE DISK_PERFORMANCE
UCHAR bBuffer[1]
Definition: helper.h:36
USHORT MaxHeads
Definition: ntdddisk.h:350
DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority
Definition: winioctl.h:269
struct _DRIVE_LAYOUT_INFORMATION_MBR DRIVE_LAYOUT_INFORMATION_MBR
USHORT SectorsPerTrack
Definition: ntdddisk.h:349
struct _DISK_PARTITION_INFO DISK_PARTITION_INFO
SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR
Definition: ntdddisk.h:545
USHORT SectorNumber[1]
Definition: ntdddisk.h:520
_MEDIA_TYPE
Definition: ntdddisk.h:306
#define _ANONYMOUS_UNION
Definition: ntbasedef.h:30
_PARTITION_STYLE
Definition: imports.h:200
struct _FORMAT_PARAMETERS FORMAT_PARAMETERS
DRIVERSTATUS DriverStatus
Definition: helper.h:26
struct _PARTITION_INFORMATION_EX * PPARTITION_INFORMATION_EX
LARGE_INTEGER IoAddress
Definition: ntdddisk.h:661
USHORT NumberDrives
Definition: ntdddisk.h:351
struct _PARTITION_INFORMATION_EX PARTITION_INFORMATION_EX
enum _MEDIA_TYPE MEDIA_TYPE
struct _DISK_CONTROLLER_NUMBER DISK_CONTROLLER_NUMBER
struct _DISK_DETECTION_INFO DISK_DETECTION_INFO
ULONG BytesPerSector
Definition: ntdddisk.h:381
ULONG TracksPerCylinder
Definition: ntdddisk.h:379
struct _SENDCMDOUTPARAMS * PSENDCMDOUTPARAMS
struct _DISK_CACHE_INFORMATION DISK_CACHE_INFORMATION
struct _PARTITION_INFORMATION PARTITION_INFORMATION
UCHAR bSectorCountReg
Definition: helper.h:10
LARGE_INTEGER ReadTime
Definition: ntdddisk.h:451
USHORT DriveSelect
Definition: ntdddisk.h:347
PARTITION_INFORMATION_MBR Mbr
Definition: imports.h:226
LARGE_INTEGER Length
Definition: imports.h:232
enum _DETECTION_TYPE DETECTION_TYPE
ULONG NumberOfBytes
Definition: ntdddisk.h:660
LARGE_INTEGER DiskSize
Definition: ntdddisk.h:386
PARTITION_INFORMATION_GPT Gpt
Definition: imports.h:227
struct _DISK_GEOMETRY_EX DISK_GEOMETRY_EX
PARTITION_STYLE PartitionStyle
Definition: imports.h:220
DISK_INT13_INFO Int13
Definition: ntdddisk.h:370
struct _GET_LENGTH_INFORMATION GET_LENGTH_INFORMATION
LARGE_INTEGER WriteTime
Definition: ntdddisk.h:452
LARGE_INTEGER BytesRead
Definition: ntdddisk.h:449
struct CREATE_DISK * PCREATE_DISK
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
struct _DISK_PARTITION_INFO * PDISK_PARTITION_INFO
struct _DISK_PERFORMANCE * PDISK_PERFORMANCE
struct _SENDCMDINPARAMS * PSENDCMDINPARAMS
struct _DISK_EX_INT13_INFO DISK_EX_INT13_INFO
struct _DRIVE_LAYOUT_INFORMATION DRIVE_LAYOUT_INFORMATION
struct _GETVERSIONINPARAMS * PGETVERSIONINPARAMS
struct _SENDCMDINPARAMS SENDCMDINPARAMS
DISK_GEOMETRY Geometry
Definition: ntdddisk.h:385
unsigned char BOOLEAN
PARTITION_INFORMATION PartitionEntry[1]
Definition: ntdddisk.h:488
UCHAR bDriverError
Definition: helper.h:2
struct _REASSIGN_BLOCKS REASSIGN_BLOCKS
SET_PARTITION_INFORMATION_MBR Mbr
Definition: ntdddisk.h:551
struct _MAPPED_ADDRESS * NextMappedAddress
Definition: ntdddisk.h:658
struct _VERIFY_INFORMATION * PVERIFY_INFORMATION
MEDIA_TYPE MediaType
Definition: ntdddisk.h:524
USHORT * PBAD_TRACK_NUMBER
Definition: ntdddisk.h:304
ULONG StartCylinderNumber
Definition: ntdddisk.h:525
ULONG MaxCylinders
Definition: ntdddisk.h:348
struct _PARTITION_INFORMATION_MBR * PPARTITION_INFORMATION_MBR
struct _IDEREGS * PIDEREGS
DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority
Definition: winioctl.h:268
UCHAR bDriveHeadReg
Definition: helper.h:14
WORD DisablePrefetchTransferLength
Definition: winioctl.h:270
IDEREGS irDriveRegs
Definition: helper.h:32
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _SENDCMDOUTPARAMS SENDCMDOUTPARAMS
ULONG BusNumber
Definition: ntdddisk.h:662
LARGE_INTEGER StartingOffset
Definition: ntdddisk.h:407
DRIVE_LAYOUT_INFORMATION_MBR Mbr
Definition: ntdddisk.h:506
struct _GETVERSIONINPARAMS * LPGETVERSIONINPARAMS
LARGE_INTEGER Cylinders
Definition: ntdddisk.h:377
UCHAR bReserved[2]
Definition: helper.h:4
enum _MEDIA_TYPE * PMEDIA_TYPE
ULONG SectorsPerTrack
Definition: ntdddisk.h:380
UCHAR bCommandReg
Definition: helper.h:15
struct _PARTITION_INFORMATION_GPT * PPARTITION_INFORMATION_GPT
USHORT BAD_TRACK_NUMBER
Definition: ntdddisk.h:303
MEDIA_TYPE MediaType
Definition: ntdddisk.h:378
struct _DISK_CACHE_INFORMATION * PDISK_CACHE_INFORMATION
PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT
Definition: ntdddisk.h:546
LARGE_INTEGER PartitionLength
Definition: imports.h:222
LARGE_INTEGER QueryTime
Definition: ntdddisk.h:458
BOOLEAN RewritePartition
Definition: ntdddisk.h:414
MEDIA_TYPE MediaType
Definition: ntdddisk.h:513
unsigned __int64 ULONG64
Definition: imports.h:198
LARGE_INTEGER StartingOffset
Definition: imports.h:221
unsigned char UCHAR
Definition: xmlstorage.h:181
_ANONYMOUS_UNION union _PARTITION_INFORMATION_EX::@3078 DUMMYUNIONNAME
PVOID MappedAddress
Definition: ntdddisk.h:659
struct _DISK_GEOMETRY * PDISK_GEOMETRY
struct _DRIVERSTATUS * LPDRIVERSTATUS
struct _IDEREGS IDEREGS
struct _DISK_GROW_PARTITION * PDISK_GROW_PARTITION
LARGE_INTEGER BytesToGrow
Definition: winioctl.h:358
UCHAR bCylLowReg
Definition: helper.h:12
_ANONYMOUS_UNION union _DISK_PARTITION_INFO::@3075 DUMMYUNIONNAME
struct _MAPPED_ADDRESS MAPPED_ADDRESS
enum _PARTITION_STYLE PARTITION_STYLE
LARGE_INTEGER BytesWritten
Definition: ntdddisk.h:450
struct _IDEREGS * LPIDEREGS
UCHAR bIDEError
Definition: helper.h:3
struct _GETVERSIONINPARAMS GETVERSIONINPARAMS
struct _SENDCMDINPARAMS * LPSENDCMDINPARAMS
#define _ANONYMOUS_STRUCT
Definition: ntbasedef.h:56
struct _DRIVE_LAYOUT_INFORMATION_EX DRIVE_LAYOUT_INFORMATION_EX
struct _FORMAT_PARAMETERS * PFORMAT_PARAMETERS
enum _PARTITION_STYLE PARTITION_STYLE
struct _SENDCMDOUTPARAMS * LPSENDCMDOUTPARAMS
UCHAR bFeaturesReg
Definition: helper.h:9
struct _PARTITION_INFORMATION_GPT PARTITION_INFORMATION_GPT
_ANONYMOUS_STRUCT struct _DISK_DETECTION_INFO::@3073::@3074 DUMMYSTRUCTNAME
DISK_EX_INT13_INFO ExInt13
Definition: ntdddisk.h:371
struct _GET_LENGTH_INFORMATION * PGET_LENGTH_INFORMATION
struct _DISK_GEOMETRY DISK_GEOMETRY
struct _PARTITION_INFORMATION * PPARTITION_INFORMATION
LARGE_INTEGER IdleTime
Definition: ntdddisk.h:453
UCHAR bReserved[3]
Definition: helper.h:34
unsigned short USHORT
Definition: pedump.c:61
#define __GNU_EXTENSION
Definition: ntdddisk.h:31
struct _PARTITION_INFORMATION_MBR PARTITION_INFORMATION_MBR
PARTITION_STYLE PartitionStyle
Definition: ntdddisk.h:549
LARGE_INTEGER StartingUsableOffset
Definition: ntdddisk.h:497
struct _DRIVE_LAYOUT_INFORMATION * PDRIVE_LAYOUT_INFORMATION
struct _SET_PARTITION_INFORMATION_EX SET_PARTITION_INFORMATION_EX
SET_PARTITION_INFORMATION_GPT Gpt
Definition: ntdddisk.h:552
_DETECTION_TYPE
Definition: ntdddisk.h:335
struct _DISK_PARTITION_INFO::@3075::@3076 Mbr
UCHAR bCylHighReg
Definition: helper.h:13
struct _DISK_CONTROLLER_NUMBER * PDISK_CONTROLLER_NUMBER
struct _REASSIGN_BLOCKS * PREASSIGN_BLOCKS
struct _FORMAT_EX_PARAMETERS * PFORMAT_EX_PARAMETERS
struct _SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION
UCHAR bBuffer[1]
Definition: helper.h:27
WCHAR StorageManagerName[8]
Definition: ntdddisk.h:460
PARTITION_INFORMATION_EX PartitionEntry[1]
Definition: ntdddisk.h:509
USHORT Reserved
Definition: ntdddisk.h:536
struct _DRIVE_LAYOUT_INFORMATION_GPT DRIVE_LAYOUT_INFORMATION_GPT
unsigned int ULONG
Definition: retypes.h:1
struct _MAPPED_ADDRESS * PMAPPED_ADDRESS
ULONG ExSectorsPerTrack
Definition: ntdddisk.h:359
LARGE_INTEGER UsableLength
Definition: ntdddisk.h:498
struct _DISK_GEOMETRY_EX * PDISK_GEOMETRY_EX
BOOLEAN RecognizedPartition
Definition: ntdddisk.h:413
struct _DISK_CACHE_INFORMATION::@3242::@3244 ScalarPrefetch
ULONG EndCylinderNumber
Definition: ntdddisk.h:526
struct _DISK_INT13_INFO * PDISK_INT13_INFO
struct _DISK_CACHE_INFORMATION::@3242::@3245 BlockPrefetch
ULONG StorageDeviceNumber
Definition: ntdddisk.h:459
struct _DRIVERSTATUS DRIVERSTATUS
UCHAR bDriveNumber
Definition: helper.h:33
struct _DISK_DETECTION_INFO * PDISK_DETECTION_INFO
ULONG SizeOfPartitionInfo
Definition: ntdddisk.h:435
struct _DISK_INT13_INFO DISK_INT13_INFO
DRIVE_LAYOUT_INFORMATION_GPT Gpt
Definition: ntdddisk.h:507
ULONG BlockNumber[1]
Definition: ntdddisk.h:538
static const WCHAR Signature[]
Definition: parser.c:141
Definition: helper.h:8
struct _FORMAT_EX_PARAMETERS FORMAT_EX_PARAMETERS
PARTITION_STYLE PartitionStyle
Definition: ntdddisk.h:436
DISK_CACHE_RETENTION_PRIORITY
Definition: winioctl.h:259
struct _DRIVE_LAYOUT_INFORMATION_MBR * PDRIVE_LAYOUT_INFORMATION_MBR
struct _DRIVE_LAYOUT_INFORMATION_EX * PDRIVE_LAYOUT_INFORMATION_EX
struct CREATE_DISK_GPT * PCREATE_DISK_GPT
struct _DISK_GROW_PARTITION DISK_GROW_PARTITION
struct _SET_PARTITION_INFORMATION * PSET_PARTITION_INFORMATION
ULONG StartHeadNumber
Definition: ntdddisk.h:527
ULONG cBufferSize
Definition: helper.h:25
LARGE_INTEGER StartingOffset
Definition: ntdddisk.h:557