1 /* 2 * mountmgr.h 3 * 4 * Mount Manager driver interface 5 * 6 * This file is part of the ReactOS DDK package. 7 * 8 * Contributors: 9 * Magnus Olsen <greatlord@reactos.org> 10 * Amine Khaldi <amine.khaldi@reactos.org> 11 * Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> 12 * 13 * THIS SOFTWARE IS NOT COPYRIGHTED 14 * 15 * This source code is offered for use in the public domain. You may 16 * use, modify or distribute it freely. 17 * 18 * This code is distributed in the hope that it will be useful but 19 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 20 * DISCLAIMED. This includes but is not limited to warranties of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 22 * 23 */ 24 25 #ifndef _MOUNTMGR_ 26 #define _MOUNTMGR_ 27 28 #pragma once 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #if (NTDDI_VERSION >= NTDDI_WIN2K) 35 36 #define MOUNTMGR_DEVICE_NAME L"\\Device\\MountPointManager" 37 #define MOUNTMGR_DOS_DEVICE_NAME L"\\\\.\\MountPointManager" 38 #define MOUNTMGRCONTROLTYPE ((ULONG)'m') 39 #define MOUNTDEVCONTROLTYPE ((ULONG)'M') 40 41 #ifdef DEFINE_GUID 42 DEFINE_GUID(MOUNTDEV_MOUNTED_DEVICE_GUID, 0x53F5630D, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B); 43 #endif 44 45 #define IOCTL_MOUNTMGR_CREATE_POINT \ 46 CTL_CODE(MOUNTMGRCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 47 #define IOCTL_MOUNTMGR_DELETE_POINTS \ 48 CTL_CODE(MOUNTMGRCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 49 #define IOCTL_MOUNTMGR_QUERY_POINTS \ 50 CTL_CODE(MOUNTMGRCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 51 #define IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY \ 52 CTL_CODE(MOUNTMGRCONTROLTYPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 53 #define IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER \ 54 CTL_CODE(MOUNTMGRCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 55 #define IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS \ 56 CTL_CODE(MOUNTMGRCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 57 #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED \ 58 CTL_CODE(MOUNTMGRCONTROLTYPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 59 #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED \ 60 CTL_CODE(MOUNTMGRCONTROLTYPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 61 #define IOCTL_MOUNTMGR_CHANGE_NOTIFY \ 62 CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS) 63 #define IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE \ 64 CTL_CODE(MOUNTMGRCONTROLTYPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 65 #define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES \ 66 CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS) 67 #define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION \ 68 CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS) 69 70 #define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME \ 71 CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 72 73 #define MOUNTMGR_IS_DRIVE_LETTER(s) \ 74 ((s)->Length == 28 && (s)->Buffer[0] == '\\' && (s)->Buffer[1] == 'D' && \ 75 (s)->Buffer[2] == 'o' && (s)->Buffer[3] == 's' && (s)->Buffer[4] == 'D' && \ 76 (s)->Buffer[5] == 'e' && (s)->Buffer[6] == 'v' && (s)->Buffer[7] == 'i' && \ 77 (s)->Buffer[8] == 'c' && (s)->Buffer[9] == 'e' && (s)->Buffer[10] == 's' && \ 78 (s)->Buffer[11] == '\\' && (s)->Buffer[12] >= 'A' && \ 79 (s)->Buffer[12] <= 'Z' && (s)->Buffer[13] == ':') 80 81 #define MOUNTMGR_IS_VOLUME_NAME(s) \ 82 (((s)->Length == 96 || ((s)->Length == 98 && (s)->Buffer[48] == '\\')) && \ 83 (s)->Buffer[0] == '\\'&& ((s)->Buffer[1] == '?' || (s)->Buffer[1] == '\\') && \ 84 (s)->Buffer[2] == '?' && (s)->Buffer[3] == '\\' && (s)->Buffer[4] == 'V' && \ 85 (s)->Buffer[5] == 'o' && (s)->Buffer[6] == 'l' && (s)->Buffer[7] == 'u' && \ 86 (s)->Buffer[8] == 'm' && (s)->Buffer[9] == 'e' && (s)->Buffer[10] == '{' && \ 87 (s)->Buffer[19] == '-' && (s)->Buffer[24] == '-' && (s)->Buffer[29] == '-' && \ 88 (s)->Buffer[34] == '-' && (s)->Buffer[47] == '}') 89 90 typedef struct _MOUNTMGR_CREATE_POINT_INPUT { 91 USHORT SymbolicLinkNameOffset; 92 USHORT SymbolicLinkNameLength; 93 USHORT DeviceNameOffset; 94 USHORT DeviceNameLength; 95 } MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT; 96 97 typedef struct _MOUNTMGR_MOUNT_POINT { 98 ULONG SymbolicLinkNameOffset; 99 USHORT SymbolicLinkNameLength; 100 ULONG UniqueIdOffset; 101 USHORT UniqueIdLength; 102 ULONG DeviceNameOffset; 103 USHORT DeviceNameLength; 104 } MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT; 105 106 typedef struct _MOUNTMGR_MOUNT_POINTS { 107 ULONG Size; 108 ULONG NumberOfMountPoints; 109 MOUNTMGR_MOUNT_POINT MountPoints[1]; 110 } MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS; 111 112 typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET { 113 USHORT DeviceNameLength; 114 WCHAR DeviceName[1]; 115 } MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET; 116 117 typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION { 118 BOOLEAN DriveLetterWasAssigned; 119 UCHAR CurrentDriveLetter; 120 } MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION; 121 122 typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT { 123 USHORT SourceVolumeNameOffset; 124 USHORT SourceVolumeNameLength; 125 USHORT TargetVolumeNameOffset; 126 USHORT TargetVolumeNameLength; 127 } MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT; 128 129 typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO { 130 ULONG EpicNumber; 131 } MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO; 132 133 typedef struct _MOUNTMGR_TARGET_NAME { 134 USHORT DeviceNameLength; 135 WCHAR DeviceName[1]; 136 } MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME; 137 138 typedef struct _MOUNTDEV_NAME { 139 USHORT NameLength; 140 WCHAR Name[1]; 141 } MOUNTDEV_NAME, *PMOUNTDEV_NAME; 142 143 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 144 145 #if (NTDDI_VERSION >= NTDDI_WINXP) 146 147 #define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH \ 148 CTL_CODE(MOUNTMGRCONTROLTYPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) 149 #define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS \ 150 CTL_CODE(MOUNTMGRCONTROLTYPE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) 151 152 #define MOUNTMGR_IS_DOS_VOLUME_NAME(s) \ 153 (MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 96 && (s)->Buffer[1] == '\\') 154 #define MOUNTMGR_IS_DOS_VOLUME_NAME_WB(s) \ 155 (MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 98 && (s)->Buffer[1] == '\\') 156 #define MOUNTMGR_IS_NT_VOLUME_NAME(s) \ 157 ( MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 96 && (s)->Buffer[1] == '?') 158 #define MOUNTMGR_IS_NT_VOLUME_NAME_WB(s) \ 159 (MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 98 && (s)->Buffer[1] == '?') 160 161 typedef struct _MOUNTMGR_VOLUME_PATHS { 162 ULONG MultiSzLength; 163 WCHAR MultiSz[1]; 164 } MOUNTMGR_VOLUME_PATHS, *PMOUNTMGR_VOLUME_PATHS; 165 166 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 167 168 #if (NTDDI_VERSION >= NTDDI_WS03) 169 170 #define IOCTL_MOUNTMGR_SCRUB_REGISTRY \ 171 CTL_CODE(MOUNTMGRCONTROLTYPE, 14, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 172 #define IOCTL_MOUNTMGR_QUERY_AUTO_MOUNT \ 173 CTL_CODE(MOUNTMGRCONTROLTYPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) 174 #define IOCTL_MOUNTMGR_SET_AUTO_MOUNT \ 175 CTL_CODE(MOUNTMGRCONTROLTYPE, 16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 176 177 typedef enum _MOUNTMGR_AUTO_MOUNT_STATE { 178 Disabled = 0, 179 Enabled 180 } MOUNTMGR_AUTO_MOUNT_STATE; 181 182 typedef struct _MOUNTMGR_QUERY_AUTO_MOUNT { 183 MOUNTMGR_AUTO_MOUNT_STATE CurrentState; 184 } MOUNTMGR_QUERY_AUTO_MOUNT, *PMOUNTMGR_QUERY_AUTO_MOUNT; 185 186 typedef struct _MOUNTMGR_SET_AUTO_MOUNT { 187 MOUNTMGR_AUTO_MOUNT_STATE NewState; 188 } MOUNTMGR_SET_AUTO_MOUNT, *PMOUNTMGR_SET_AUTO_MOUNT; 189 190 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 191 192 #if (NTDDI_VERSION >= NTDDI_WIN7) 193 194 #define IOCTL_MOUNTMGR_BOOT_DL_ASSIGNMENT \ 195 CTL_CODE(MOUNTMGRCONTROLTYPE, 17, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 196 #define IOCTL_MOUNTMGR_TRACELOG_CACHE \ 197 CTL_CODE(MOUNTMGRCONTROLTYPE, 18, METHOD_BUFFERED, FILE_READ_ACCESS) 198 199 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 200 201 #ifdef __cplusplus 202 } /* extern "C" */ 203 #endif 204 205 #endif /* _MOUNTMGR_ */ 206