1 #ifndef _MOUNTMGR_ 2 #define _MOUNTMGR_ 3 4 #if (NTDDI_VERSION >= NTDDI_WIN2K) 5 6 #if defined(DEFINE_GUID) 7 DEFINE_GUID(MOUNTDEV_MOUNTED_DEVICE_GUID, 0x53F5630D, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B); 8 #endif 9 10 #define MOUNTMGR_DEVICE_NAME L"\\Device\\MountPointManager" 11 #define MOUNTMGR_DOS_DEVICE_NAME L"\\\\.\\MountPointManager" 12 #define MOUNTMGRCONTROLTYPE ((ULONG) 'm') 13 #define MOUNTDEVCONTROLTYPE ((ULONG) 'M') 14 15 #define IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 32, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 16 #define IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 33, METHOD_BUFFERED, FILE_READ_ACCESS) 17 18 struct mountmgr_unix_drive { 19 ULONG size; 20 ULONG type; 21 WCHAR letter; 22 USHORT mount_point_offset; 23 USHORT device_offset; 24 }; 25 26 #define IOCTL_MOUNTMGR_CREATE_POINT \ 27 CTL_CODE(MOUNTMGRCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 28 #define IOCTL_MOUNTMGR_DELETE_POINTS \ 29 CTL_CODE(MOUNTMGRCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 30 #define IOCTL_MOUNTMGR_QUERY_POINTS \ 31 CTL_CODE(MOUNTMGRCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 32 #define IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY \ 33 CTL_CODE(MOUNTMGRCONTROLTYPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 34 #define IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER \ 35 CTL_CODE(MOUNTMGRCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 36 #define IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS \ 37 CTL_CODE(MOUNTMGRCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 38 #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED \ 39 CTL_CODE(MOUNTMGRCONTROLTYPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 40 #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED \ 41 CTL_CODE(MOUNTMGRCONTROLTYPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 42 #define IOCTL_MOUNTMGR_CHANGE_NOTIFY \ 43 CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS) 44 #define IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE \ 45 CTL_CODE(MOUNTMGRCONTROLTYPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 46 #define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES \ 47 CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS) 48 #define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION \ 49 CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS) 50 #define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME \ 51 CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) 52 53 #define MOUNTMGR_IS_DRIVE_LETTER(s) ((s)->Length == 28 && (s)->Buffer[0] == '\\' && (s)->Buffer[1] == 'D' && \ 54 (s)->Buffer[2] == 'o' && (s)->Buffer[3] == 's' && (s)->Buffer[4] == 'D' && \ 55 (s)->Buffer[5] == 'e' && \ (s)->Buffer[6] == 'v' && (s)->Buffer[7] == 'i' && \ 56 (s)->Buffer[8] == 'c' && (s)->Buffer[9] == 'e' && (s)->Buffer[10] == 's' && \ 57 (s)->Buffer[11] == '\\' && (s)->Buffer[12] >= 'A' && \ 58 (s)->Buffer[12] <= 'Z' && (s)->Buffer[13] == ':') 59 60 #define MOUNTMGR_IS_VOLUME_NAME(s) (((s)->Length == 96 || ((s)->Length == 98 && (s)->Buffer[48] == '\\')) && \ 61 (s)->Buffer[0] == '\\'&& ((s)->Buffer[1] == '?' || (s)->Buffer[1] == '\\') && \ 62 (s)->Buffer[2] == '?' && (s)->Buffer[3] == '\\' && (s)->Buffer[4] == 'V' && \ 63 (s)->Buffer[5] == 'o' && (s)->Buffer[6] == 'l' && (s)->Buffer[7] == 'u' && \ 64 (s)->Buffer[8] == 'm' && (s)->Buffer[9] == 'e' && (s)->Buffer[10] == '{' && \ 65 (s)->Buffer[19] == '-' && (s)->Buffer[24] == '-' && (s)->Buffer[29] == '-' && \ 66 (s)->Buffer[34] == '-' && (s)->Buffer[47] == '}') 67 68 typedef struct _MOUNTMGR_CREATE_POINT_INPUT { 69 USHORT SymbolicLinkNameOffset; 70 USHORT SymbolicLinkNameLength; 71 USHORT DeviceNameOffset; 72 USHORT DeviceNameLength; 73 } MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT; 74 75 typedef struct _MOUNTMGR_MOUNT_POINT { 76 ULONG SymbolicLinkNameOffset; 77 USHORT SymbolicLinkNameLength; 78 ULONG UniqueIdOffset; 79 USHORT UniqueIdLength; 80 ULONG DeviceNameOffset; 81 USHORT DeviceNameLength; 82 } MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT; 83 84 typedef struct _MOUNTMGR_MOUNT_POINTS { 85 ULONG Size; 86 ULONG NumberOfMountPoints; 87 MOUNTMGR_MOUNT_POINT MountPoints[1]; 88 } MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS; 89 90 typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET { 91 USHORT DeviceNameLength; 92 WCHAR DeviceName[1]; 93 } MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET; 94 95 typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION { 96 BOOLEAN DriveLetterWasAssigned; 97 UCHAR CurrentDriveLetter; 98 } MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION; 99 100 typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT { 101 USHORT SourceVolumeNameOffset; 102 USHORT SourceVolumeNameLength; 103 USHORT TargetVolumeNameOffset; 104 USHORT TargetVolumeNameLength; 105 } MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT; 106 107 typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO { 108 ULONG EpicNumber; 109 } MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO; 110 111 typedef struct _MOUNTMGR_TARGET_NAME { 112 USHORT DeviceNameLength; 113 WCHAR DeviceName[1]; 114 } MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME; 115 116 typedef struct _MOUNTDEV_NAME { 117 USHORT NameLength; 118 WCHAR Name[1]; 119 } MOUNTDEV_NAME, *PMOUNTDEV_NAME; 120 121 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 122 123 #if (NTDDI_VERSION >= NTDDI_WINXP) 124 125 #define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH \ 126 CTL_CODE(MOUNTMGRCONTROLTYPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) 127 #define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS \ 128 CTL_CODE(MOUNTMGRCONTROLTYPE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) 129 130 #define MOUNTMGR_IS_DOS_VOLUME_NAME(s) (MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 96 && (s)->Buffer[1] == '\\') 131 #define MOUNTMGR_IS_DOS_VOLUME_NAME_WB(s) (MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 98 && (s)->Buffer[1] == '\\') 132 #define MOUNTMGR_IS_NT_VOLUME_NAME(s) ( MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 96 && (s)->Buffer[1] == '?') 133 #define MOUNTMGR_IS_NT_VOLUME_NAME_WB(s) (MOUNTMGR_IS_VOLUME_NAME(s) && (s)->Length == 98 && (s)->Buffer[1] == '?') 134 135 typedef struct _MOUNTMGR_VOLUME_PATHS { 136 ULONG MultiSzLength; 137 WCHAR MultiSz[1]; 138 } MOUNTMGR_VOLUME_PATHS, *PMOUNTMGR_VOLUME_PATHS; 139 140 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 141 142 #if (NTDDI_VERSION >= NTDDI_WS03) 143 144 #define IOCTL_MOUNTMGR_SCRUB_REGISTRY \ 145 CTL_CODE(MOUNTMGRCONTROLTYPE, 14, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 146 #define IOCTL_MOUNTMGR_QUERY_AUTO_MOUNT \ 147 CTL_CODE(MOUNTMGRCONTROLTYPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) 148 #define IOCTL_MOUNTMGR_SET_AUTO_MOUNT \ 149 CTL_CODE(MOUNTMGRCONTROLTYPE, 16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 150 151 typedef enum _MOUNTMGR_AUTO_MOUNT_STATE { 152 Disabled = 0, 153 Enabled 154 } MOUNTMGR_AUTO_MOUNT_STATE; 155 156 typedef struct _MOUNTMGR_QUERY_AUTO_MOUNT { 157 MOUNTMGR_AUTO_MOUNT_STATE CurrentState; 158 } MOUNTMGR_QUERY_AUTO_MOUNT, *PMOUNTMGR_QUERY_AUTO_MOUNT; 159 160 typedef struct _MOUNTMGR_SET_AUTO_MOUNT { 161 MOUNTMGR_AUTO_MOUNT_STATE NewState; 162 } MOUNTMGR_SET_AUTO_MOUNT, *PMOUNTMGR_SET_AUTO_MOUNT; 163 164 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 165 166 #if (NTDDI_VERSION >= NTDDI_WIN7) 167 168 #define IOCTL_MOUNTMGR_BOOT_DL_ASSIGNMENT \ 169 CTL_CODE(MOUNTMGRCONTROLTYPE, 17, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 170 #define IOCTL_MOUNTMGR_TRACELOG_CACHE \ 171 CTL_CODE(MOUNTMGRCONTROLTYPE, 18, METHOD_BUFFERED, FILE_READ_ACCESS) 172 173 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 174 175 #endif /* _MOUNTMGR_ */ 176 177