2 * DDK definitions for storage media access
4 * Copyright (C) 2002 Eric Pouech
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
30 #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
31 #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
32 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
33 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
36 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
37 #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
38 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
39 #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
40 #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
41 #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 typedef struct _STORAGE_DEVICE_NUMBER
{
45 DEVICE_TYPE DeviceType
;
47 ULONG PartitionNumber
;
48 } STORAGE_DEVICE_NUMBER
, *PSTORAGE_DEVICE_NUMBER
;
50 typedef struct _STORAGE_BUS_RESET_REQUEST
{
52 } STORAGE_BUS_RESET_REQUEST
, *PSTORAGE_BUS_RESET_REQUEST
;
54 typedef struct _PREVENT_MEDIA_REMOVAL
{
55 BOOLEAN PreventMediaRemoval
;
56 } PREVENT_MEDIA_REMOVAL
, *PPREVENT_MEDIA_REMOVAL
;
58 typedef struct _TAPE_STATISTICS
{
61 LARGE_INTEGER RecoveredWrites
;
62 LARGE_INTEGER UnrecoveredWrites
;
63 LARGE_INTEGER RecoveredReads
;
64 LARGE_INTEGER UnrecoveredReads
;
65 UCHAR CompressionRatioReads
;
66 UCHAR CompressionRatioWrites
;
67 } TAPE_STATISTICS
, *PTAPE_STATISTICS
;
69 #define RECOVERED_WRITES_VALID 0x00000001
70 #define UNRECOVERED_WRITES_VALID 0x00000002
71 #define RECOVERED_READS_VALID 0x00000004
72 #define UNRECOVERED_READS_VALID 0x00000008
73 #define WRITE_COMPRESSION_INFO_VALID 0x00000010
74 #define READ_COMPRESSION_INFO_VALID 0x00000020
76 typedef struct _TAPE_GET_STATISTICS
{
78 } TAPE_GET_STATISTICS
, *PTAPE_GET_STATISTICS
;
80 #define TAPE_RETURN_STATISTICS 0L
81 #define TAPE_RETURN_ENV_INFO 1L
82 #define TAPE_RESET_STATISTICS 2L
84 typedef enum _STORAGE_MEDIA_TYPE
{
85 /* see also defines in ntdddisk.h */
135 } STORAGE_MEDIA_TYPE
, *PSTORAGE_MEDIA_TYPE
;
137 #define MEDIA_ERASEABLE 0x00000001
138 #define MEDIA_WRITE_ONCE 0x00000002
139 #define MEDIA_READ_ONLY 0x00000004
140 #define MEDIA_READ_WRITE 0x00000008
141 #define MEDIA_WRITE_PROTECTED 0x00000100
142 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
144 typedef struct _DEVICE_MEDIA_INFO
{
147 LARGE_INTEGER Cylinders
;
148 STORAGE_MEDIA_TYPE MediaType
;
149 ULONG TracksPerCylinder
;
150 ULONG SectorsPerTrack
;
151 ULONG BytesPerSector
;
152 ULONG NumberMediaSides
;
153 ULONG MediaCharacteristics
;
156 LARGE_INTEGER Cylinders
;
157 STORAGE_MEDIA_TYPE MediaType
;
158 ULONG TracksPerCylinder
;
159 ULONG SectorsPerTrack
;
160 ULONG BytesPerSector
;
161 ULONG NumberMediaSides
;
162 ULONG MediaCharacteristics
;
165 STORAGE_MEDIA_TYPE MediaType
;
166 ULONG MediaCharacteristics
;
167 ULONG CurrentBlockSize
;
170 } DEVICE_MEDIA_INFO
, *PDEVICE_MEDIA_INFO
;
172 typedef struct _GET_MEDIA_TYPES
{
174 ULONG MediaInfoCount
;
175 DEVICE_MEDIA_INFO MediaInfo
[1];
176 } GET_MEDIA_TYPES
, *PGET_MEDIA_TYPES
;
178 typedef enum _STORAGE_QUERY_TYPE
{
179 PropertyStandardQuery
= 0,
182 PropertyQueryMaxDefined
183 } STORAGE_QUERY_TYPE
, *PSTORAGE_QUERY_TYPE
;
185 typedef enum _STORAGE_PROPERTY_ID
{
186 StorageDeviceProperty
= 0,
187 StorageAdapterProperty
188 } STORAGE_PROPERTY_ID
, *PSTORAGE_PROPERTY_ID
;
190 typedef struct _STORAGE_PROPERTY_QUERY
{
191 STORAGE_PROPERTY_ID PropertyId
;
192 STORAGE_QUERY_TYPE QueryType
;
193 UCHAR AdditionalParameters
[1];
194 } STORAGE_PROPERTY_QUERY
, *PSTORAGE_PROPERTY_QUERY
;
196 typedef struct _STORAGE_DESCRIPTOR_HEADER
{
199 } STORAGE_DESCRIPTOR_HEADER
, *PSTORAGE_DESCRIPTOR_HEADER
;
201 typedef enum _STORAGE_BUS_TYPE
{
202 BusTypeUnknown
= 0x00,
209 BusTypeMaxReserved
= 0x7F
210 } STORAGE_BUS_TYPE
, *PSTORAGE_BUS_TYPE
;
212 typedef struct _STORAGE_DEVICE_DESCRIPTOR
{
216 UCHAR DeviceTypeModifier
;
217 BOOLEAN RemovableMedia
;
218 BOOLEAN CommandQueueing
;
219 ULONG VendorIdOffset
;
220 ULONG ProductIdOffset
;
221 ULONG ProductRevisionOffset
;
222 ULONG SerialNumberOffset
;
223 STORAGE_BUS_TYPE BusType
;
224 ULONG RawPropertiesLength
;
225 UCHAR RawDeviceProperties
[1];
226 } STORAGE_DEVICE_DESCRIPTOR
, *PSTORAGE_DEVICE_DESCRIPTOR
;
228 typedef struct _STORAGE_ADAPTER_DESCRIPTOR
{
231 ULONG MaximumTransferLength
;
232 ULONG MaximumPhysicalPages
;
234 BOOLEAN AdapterUsesPio
;
235 BOOLEAN AdapterScansDown
;
236 BOOLEAN CommandQueueing
;
237 BOOLEAN AcceleratedTransfer
;
239 USHORT BusMajorVersion
;
240 USHORT BusMinorVersion
;
241 } STORAGE_ADAPTER_DESCRIPTOR
, *PSTORAGE_ADAPTER_DESCRIPTOR
;
247 #endif /* _NTDDSTOR_H_ */