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