xref: /reactos/sdk/include/psdk/ntddvol.h (revision 50271949)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * ntddvol.h
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Volume IOCTL interface.
5c2c66affSColin Finck  *
6*50271949SHermès Bélusca-Maïto  * This file is part of the ReactOS DDK package.
7c2c66affSColin Finck  *
8c2c66affSColin Finck  * Contributors:
9c2c66affSColin Finck  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10*50271949SHermès Bélusca-Maïto  *   Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
11c2c66affSColin Finck  *
12c2c66affSColin Finck  * THIS SOFTWARE IS NOT COPYRIGHTED
13c2c66affSColin Finck  *
14c2c66affSColin Finck  * This source code is offered for use in the public domain. You may
15c2c66affSColin Finck  * use, modify or distribute it freely.
16c2c66affSColin Finck  *
17c2c66affSColin Finck  * This code is distributed in the hope that it will be useful but
18c2c66affSColin Finck  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19c2c66affSColin Finck  * DISCLAIMED. This includes but is not limited to warranties of
20c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21c2c66affSColin Finck  *
22c2c66affSColin Finck  */
23c2c66affSColin Finck 
24c2c66affSColin Finck #ifndef _NTDDVOL_
25c2c66affSColin Finck #define _NTDDVOL_
26c2c66affSColin Finck 
27c2c66affSColin Finck #ifdef __cplusplus
28c2c66affSColin Finck extern "C" {
29c2c66affSColin Finck #endif
30c2c66affSColin Finck 
31*50271949SHermès Bélusca-Maïto #if defined(_WINIOCTL_) || defined(IOCTL_VOLUME_BASE)
32*50271949SHermès Bélusca-Maïto // Definitions duplicated in winioctl.h
33*50271949SHermès Bélusca-Maïto #define _WINIOCTL_DEFINED_
34*50271949SHermès Bélusca-Maïto #endif
35*50271949SHermès Bélusca-Maïto 
36*50271949SHermès Bélusca-Maïto #ifndef _WINIOCTL_DEFINED_
37c2c66affSColin Finck #define IOCTL_VOLUME_BASE                 ((ULONG) 'V')
38*50271949SHermès Bélusca-Maïto #endif /* _WINIOCTL_DEFINED_ */
39c2c66affSColin Finck 
40c2c66affSColin Finck 
41*50271949SHermès Bélusca-Maïto #if (NTDDI_VERSION >= NTDDI_WIN2K)
42c2c66affSColin Finck 
43*50271949SHermès Bélusca-Maïto #ifndef _WINIOCTL_DEFINED_
44c2c66affSColin Finck #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS \
45c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
46c2c66affSColin Finck 
47*50271949SHermès Bélusca-Maïto typedef struct _DISK_EXTENT {
48*50271949SHermès Bélusca-Maïto   ULONG DiskNumber;
49*50271949SHermès Bélusca-Maïto   LARGE_INTEGER StartingOffset;
50*50271949SHermès Bélusca-Maïto   LARGE_INTEGER ExtentLength;
51*50271949SHermès Bélusca-Maïto } DISK_EXTENT, *PDISK_EXTENT;
52c2c66affSColin Finck 
53*50271949SHermès Bélusca-Maïto typedef struct _VOLUME_DISK_EXTENTS {
54*50271949SHermès Bélusca-Maïto   ULONG NumberOfDiskExtents;
55*50271949SHermès Bélusca-Maïto   DISK_EXTENT Extents[1];
56*50271949SHermès Bélusca-Maïto } VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS;
57*50271949SHermès Bélusca-Maïto #endif /* _WINIOCTL_DEFINED_ */
58c2c66affSColin Finck 
59c2c66affSColin Finck #define IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE \
60c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
61c2c66affSColin Finck 
62*50271949SHermès Bélusca-Maïto #ifndef _WINIOCTL_DEFINED_
63c2c66affSColin Finck #define IOCTL_VOLUME_ONLINE \
64c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
65c2c66affSColin Finck 
66c2c66affSColin Finck #define IOCTL_VOLUME_OFFLINE \
67c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
68*50271949SHermès Bélusca-Maïto #endif /* _WINIOCTL_DEFINED_ */
69c2c66affSColin Finck 
70c2c66affSColin Finck #define IOCTL_VOLUME_IS_OFFLINE \
71c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
72c2c66affSColin Finck 
73c2c66affSColin Finck #define IOCTL_VOLUME_IS_IO_CAPABLE \
74c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
75c2c66affSColin Finck 
76c2c66affSColin Finck #define IOCTL_VOLUME_QUERY_FAILOVER_SET \
77c2c66affSColin Finck   CTL_CODE(IOCTL_VOLUME_BASE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
78c2c66affSColin Finck 
79*50271949SHermès Bélusca-Maïto typedef struct _VOLUME_FAILOVER_SET {
80*50271949SHermès Bélusca-Maïto   ULONG NumberOfDisks;
81*50271949SHermès Bélusca-Maïto   ULONG DiskNumbers[1];
82*50271949SHermès Bélusca-Maïto } VOLUME_FAILOVER_SET, *PVOLUME_FAILOVER_SET;
83*50271949SHermès Bélusca-Maïto 
84*50271949SHermès Bélusca-Maïto 
85*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_QUERY_VOLUME_NUMBER \
86*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
87*50271949SHermès Bélusca-Maïto 
88*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_LOGICAL_TO_PHYSICAL \
89*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
90*50271949SHermès Bélusca-Maïto 
91*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_PHYSICAL_TO_LOGICAL \
92*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
93*50271949SHermès Bélusca-Maïto 
94*50271949SHermès Bélusca-Maïto typedef struct _VOLUME_NUMBER {
95*50271949SHermès Bélusca-Maïto   ULONG VolumeNumber;
96*50271949SHermès Bélusca-Maïto   WCHAR VolumeManagerName[8];
97*50271949SHermès Bélusca-Maïto } VOLUME_NUMBER, *PVOLUME_NUMBER;
98c2c66affSColin Finck 
99c2c66affSColin Finck typedef struct _VOLUME_LOGICAL_OFFSET {
100c2c66affSColin Finck   LONGLONG  LogicalOffset;
101c2c66affSColin Finck } VOLUME_LOGICAL_OFFSET, *PVOLUME_LOGICAL_OFFSET;
102c2c66affSColin Finck 
103c2c66affSColin Finck typedef struct _VOLUME_PHYSICAL_OFFSET {
104c2c66affSColin Finck   ULONG  DiskNumber;
105c2c66affSColin Finck   LONGLONG  Offset;
106c2c66affSColin Finck } VOLUME_PHYSICAL_OFFSET, *PVOLUME_PHYSICAL_OFFSET;
107c2c66affSColin Finck 
108c2c66affSColin Finck typedef struct _VOLUME_PHYSICAL_OFFSETS {
109c2c66affSColin Finck   ULONG  NumberOfPhysicalOffsets;
110c2c66affSColin Finck   VOLUME_PHYSICAL_OFFSET  PhysicalOffset[1];
111c2c66affSColin Finck } VOLUME_PHYSICAL_OFFSETS, *PVOLUME_PHYSICAL_OFFSETS;
112c2c66affSColin Finck 
113*50271949SHermès Bélusca-Maïto #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
114*50271949SHermès Bélusca-Maïto 
115*50271949SHermès Bélusca-Maïto 
116*50271949SHermès Bélusca-Maïto #if (NTDDI_VERSION >= NTDDI_WINXP)
117*50271949SHermès Bélusca-Maïto 
118*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_IS_PARTITION \
119*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
120*50271949SHermès Bélusca-Maïto 
121*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_READ_PLEX \
122*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 11, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
123*50271949SHermès Bélusca-Maïto 
124*50271949SHermès Bélusca-Maïto #ifndef _WINIOCTL_DEFINED_
125*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_IS_CLUSTERED \
126*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
127*50271949SHermès Bélusca-Maïto #endif /* _WINIOCTL_DEFINED_ */
128*50271949SHermès Bélusca-Maïto 
129*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_SET_GPT_ATTRIBUTES \
130*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
131*50271949SHermès Bélusca-Maïto 
132*50271949SHermès Bélusca-Maïto #ifndef _WINIOCTL_DEFINED_
133*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \
134*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
135*50271949SHermès Bélusca-Maïto #endif /* _WINIOCTL_DEFINED_ */
136*50271949SHermès Bélusca-Maïto 
137c2c66affSColin Finck typedef struct _VOLUME_READ_PLEX_INPUT {
138c2c66affSColin Finck   LARGE_INTEGER  ByteOffset;
139c2c66affSColin Finck   ULONG  Length;
140c2c66affSColin Finck   ULONG  PlexNumber;
141c2c66affSColin Finck } VOLUME_READ_PLEX_INPUT, *PVOLUME_READ_PLEX_INPUT;
142c2c66affSColin Finck 
143c2c66affSColin Finck typedef struct _VOLUME_SET_GPT_ATTRIBUTES_INFORMATION {
144c2c66affSColin Finck   ULONGLONG GptAttributes;
145c2c66affSColin Finck   BOOLEAN RevertOnClose;
146c2c66affSColin Finck   BOOLEAN ApplyToAllConnectedVolumes;
147c2c66affSColin Finck   USHORT Reserved1;
148c2c66affSColin Finck   ULONG Reserved2;
149c2c66affSColin Finck } VOLUME_SET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_SET_GPT_ATTRIBUTES_INFORMATION;
150c2c66affSColin Finck 
151*50271949SHermès Bélusca-Maïto #ifndef _WINIOCTL_DEFINED_
152*50271949SHermès Bélusca-Maïto typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION {
153*50271949SHermès Bélusca-Maïto   ULONGLONG  GptAttributes;
154*50271949SHermès Bélusca-Maïto } VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION;
155*50271949SHermès Bélusca-Maïto #endif /* _WINIOCTL_DEFINED_ */
156c2c66affSColin Finck 
157*50271949SHermès Bélusca-Maïto #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
158c2c66affSColin Finck 
159c2c66affSColin Finck 
160*50271949SHermès Bélusca-Maïto #if (NTDDI_VERSION >= NTDDI_VISTA)
161*50271949SHermès Bélusca-Maïto // TODO: Missing definitions
162*50271949SHermès Bélusca-Maïto #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
163*50271949SHermès Bélusca-Maïto 
164*50271949SHermès Bélusca-Maïto 
165*50271949SHermès Bélusca-Maïto #if (NTDDI_VERSION >= NTDDI_WIN8)
166*50271949SHermès Bélusca-Maïto 
167*50271949SHermès Bélusca-Maïto #define IOCTL_VOLUME_POST_ONLINE \
168*50271949SHermès Bélusca-Maïto   CTL_CODE(IOCTL_VOLUME_BASE, 25, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
169*50271949SHermès Bélusca-Maïto 
170*50271949SHermès Bélusca-Maïto #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
171*50271949SHermès Bélusca-Maïto 
172*50271949SHermès Bélusca-Maïto 
173*50271949SHermès Bélusca-Maïto #ifdef _WINIOCTL_DEFINED_
174*50271949SHermès Bélusca-Maïto #undef _WINIOCTL_DEFINED_
175*50271949SHermès Bélusca-Maïto #endif
176c2c66affSColin Finck 
177c2c66affSColin Finck #ifdef __cplusplus
178c2c66affSColin Finck }
179c2c66affSColin Finck #endif
180c2c66affSColin Finck 
181c2c66affSColin Finck #endif /* _NTDDVOL_ */
182