1 /*
2  * ntddvol.h
3  *
4  * Volume 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 _NTDDVOL_
24 #define _NTDDVOL_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define IOCTL_VOLUME_BASE                 ((ULONG) 'V')
31 
32 #define IOCTL_VOLUME_LOGICAL_TO_PHYSICAL \
33   CTL_CODE(IOCTL_VOLUME_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
34 
35 #define IOCTL_VOLUME_PHYSICAL_TO_LOGICAL \
36   CTL_CODE(IOCTL_VOLUME_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
37 
38 #define IOCTL_VOLUME_READ_PLEX \
39   CTL_CODE(IOCTL_VOLUME_BASE, 11, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
40 
41 #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS \
42   CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
43 
44 #define IOCTL_VOLUME_IS_CLUSTERED \
45   CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
46 
47 #define IOCTL_VOLUME_QUERY_VOLUME_NUMBER \
48   CTL_CODE(IOCTL_VOLUME_BASE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
49 
50 #define IOCTL_VOLUME_IS_PARTITION \
51   CTL_CODE(IOCTL_VOLUME_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
52 
53 #define IOCTL_VOLUME_SET_GPT_ATTRIBUTES \
54   CTL_CODE(IOCTL_VOLUME_BASE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
55 
56 #define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \
57   CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
58 
59 #define IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE \
60   CTL_CODE(IOCTL_VOLUME_BASE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
61 
62 #define IOCTL_VOLUME_ONLINE \
63   CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
64 
65 #define IOCTL_VOLUME_OFFLINE \
66   CTL_CODE(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
67 
68 #define IOCTL_VOLUME_IS_OFFLINE \
69   CTL_CODE(IOCTL_VOLUME_BASE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
70 
71 #define IOCTL_VOLUME_IS_IO_CAPABLE \
72   CTL_CODE(IOCTL_VOLUME_BASE, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
73 
74 #define IOCTL_VOLUME_QUERY_FAILOVER_SET \
75   CTL_CODE(IOCTL_VOLUME_BASE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
76 
77 
78 typedef struct _VOLUME_LOGICAL_OFFSET {
79   LONGLONG  LogicalOffset;
80 } VOLUME_LOGICAL_OFFSET, *PVOLUME_LOGICAL_OFFSET;
81 
82 typedef struct _VOLUME_PHYSICAL_OFFSET {
83   ULONG  DiskNumber;
84   LONGLONG  Offset;
85 } VOLUME_PHYSICAL_OFFSET, *PVOLUME_PHYSICAL_OFFSET;
86 
87 typedef struct _VOLUME_PHYSICAL_OFFSETS {
88   ULONG  NumberOfPhysicalOffsets;
89   VOLUME_PHYSICAL_OFFSET  PhysicalOffset[1];
90 } VOLUME_PHYSICAL_OFFSETS, *PVOLUME_PHYSICAL_OFFSETS;
91 
92 typedef struct _VOLUME_READ_PLEX_INPUT {
93   LARGE_INTEGER  ByteOffset;
94   ULONG  Length;
95   ULONG  PlexNumber;
96 } VOLUME_READ_PLEX_INPUT, *PVOLUME_READ_PLEX_INPUT;
97 
98 typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION {
99   ULONGLONG  GptAttributes;
100 } VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION;
101 
102 typedef struct _VOLUME_SET_GPT_ATTRIBUTES_INFORMATION {
103 	ULONGLONG  GptAttributes;
104 	BOOLEAN  RevertOnClose;
105 	BOOLEAN  ApplyToAllConnectedVolumes;
106 	USHORT  Reserved1;
107 	ULONG  Reserved2;
108 } VOLUME_SET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_SET_GPT_ATTRIBUTES_INFORMATION;
109 
110 typedef struct _DISK_EXTENT {
111 	ULONG  DiskNumber;
112 	LARGE_INTEGER  StartingOffset;
113 	LARGE_INTEGER  ExtentLength;
114 } DISK_EXTENT, *PDISK_EXTENT;
115 
116 typedef struct _VOLUME_DISK_EXTENTS {
117 	ULONG  NumberOfDiskExtents;
118 	DISK_EXTENT  Extents[1];
119 } VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS;
120 
121 typedef struct _VOLUME_NUMBER {
122 	ULONG  VolumeNumber;
123 	WCHAR  VolumeManagerName[8];
124 } VOLUME_NUMBER, *PVOLUME_NUMBER;
125 
126 typedef struct _VOLUME_FAILOVER_SET {
127 	ULONG  NumberOfDisks;
128 	ULONG  DiskNumbers[1];
129 } VOLUME_FAILOVER_SET, *PVOLUME_FAILOVER_SET;
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* _NTDDVOL_ */
136