Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
8.9 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. mountmgr.h
  5. Abstract:
  6. This file defines the external mount point interface for administering
  7. mount points.
  8. Author:
  9. norbertk
  10. Revision History:
  11. --*/
  12. #ifndef _MOUNTMGR_
  13. #define _MOUNTMGR_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifndef FAR
  18. #define FAR
  19. #endif
  20. #define MOUNTMGR_DEVICE_NAME L"\\Device\\MountPointManager"
  21. #define MOUNTMGR_DOS_DEVICE_NAME L"\\\\.\\MountPointManager"
  22. #define MOUNTMGRCONTROLTYPE ((ULONG) 'm')
  23. #define MOUNTDEVCONTROLTYPE ((ULONG) 'M')
  24. //
  25. // These are the IOCTLs supported by the mount point manager.
  26. //
  27. #define IOCTL_MOUNTMGR_CREATE_POINT CTL_CODE(MOUNTMGRCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  28. #define IOCTL_MOUNTMGR_DELETE_POINTS CTL_CODE(MOUNTMGRCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  29. #define IOCTL_MOUNTMGR_QUERY_POINTS CTL_CODE(MOUNTMGRCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
  30. #define IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY CTL_CODE(MOUNTMGRCONTROLTYPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  31. #define IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER CTL_CODE(MOUNTMGRCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  32. #define IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS CTL_CODE(MOUNTMGRCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  33. #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED CTL_CODE(MOUNTMGRCONTROLTYPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  34. #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED CTL_CODE(MOUNTMGRCONTROLTYPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  35. #define IOCTL_MOUNTMGR_CHANGE_NOTIFY CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS)
  36. #define IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE CTL_CODE(MOUNTMGRCONTROLTYPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  37. #define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
  38. #define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
  39. #define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH CTL_CODE(MOUNTMGRCONTROLTYPE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
  40. #define IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS CTL_CODE(MOUNTMGRCONTROLTYPE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
  41. //
  42. // Input structure for IOCTL_MOUNTMGR_CREATE_POINT.
  43. //
  44. typedef struct _MOUNTMGR_CREATE_POINT_INPUT {
  45. USHORT SymbolicLinkNameOffset;
  46. USHORT SymbolicLinkNameLength;
  47. USHORT DeviceNameOffset;
  48. USHORT DeviceNameLength;
  49. } MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT;
  50. //
  51. // Input structure for IOCTL_MOUNTMGR_DELETE_POINTS,
  52. // IOCTL_MOUNTMGR_QUERY_POINTS, and IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY.
  53. //
  54. typedef struct _MOUNTMGR_MOUNT_POINT {
  55. ULONG SymbolicLinkNameOffset;
  56. USHORT SymbolicLinkNameLength;
  57. ULONG UniqueIdOffset;
  58. USHORT UniqueIdLength;
  59. ULONG DeviceNameOffset;
  60. USHORT DeviceNameLength;
  61. } MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT;
  62. //
  63. // Output structure for IOCTL_MOUNTMGR_DELETE_POINTS,
  64. // IOCTL_MOUNTMGR_QUERY_POINTS, and IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY.
  65. //
  66. typedef struct _MOUNTMGR_MOUNT_POINTS {
  67. ULONG Size;
  68. ULONG NumberOfMountPoints;
  69. MOUNTMGR_MOUNT_POINT MountPoints[1];
  70. } MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS;
  71. //
  72. // Input structure for IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER.
  73. //
  74. typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET {
  75. USHORT DeviceNameLength;
  76. WCHAR DeviceName[1];
  77. } MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET;
  78. //
  79. // Output structure for IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER.
  80. //
  81. typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION {
  82. BOOLEAN DriveLetterWasAssigned;
  83. UCHAR CurrentDriveLetter;
  84. } MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION;
  85. //
  86. // Input structure for IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED and
  87. // IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED.
  88. //
  89. typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT {
  90. USHORT SourceVolumeNameOffset;
  91. USHORT SourceVolumeNameLength;
  92. USHORT TargetVolumeNameOffset;
  93. USHORT TargetVolumeNameLength;
  94. } MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT;
  95. //
  96. // Input structure for IOCTL_MOUNTMGR_CHANGE_NOTIFY.
  97. // Output structure for IOCTL_MOUNTMGR_CHANGE_NOTIFY.
  98. //
  99. typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO {
  100. ULONG EpicNumber;
  101. } MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO;
  102. //
  103. // Input structure for IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE,
  104. // IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION,
  105. // IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH, and
  106. // IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS.
  107. //
  108. typedef struct _MOUNTMGR_TARGET_NAME {
  109. USHORT DeviceNameLength;
  110. WCHAR DeviceName[1];
  111. } MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME;
  112. //
  113. // Output structure for IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH and
  114. // IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS.
  115. //
  116. typedef struct _MOUNTMGR_VOLUME_PATHS {
  117. ULONG MultiSzLength;
  118. WCHAR MultiSz[1];
  119. } MOUNTMGR_VOLUME_PATHS, *PMOUNTMGR_VOLUME_PATHS;
  120. //
  121. // Macro that defines what a "drive letter" mount point is. This macro can
  122. // be used to scan the result from QUERY_POINTS to discover which mount points
  123. // are find "drive letter" mount points.
  124. //
  125. #define MOUNTMGR_IS_DRIVE_LETTER(s) ( \
  126. (s)->Length == 28 && \
  127. (s)->Buffer[0] == '\\' && \
  128. (s)->Buffer[1] == 'D' && \
  129. (s)->Buffer[2] == 'o' && \
  130. (s)->Buffer[3] == 's' && \
  131. (s)->Buffer[4] == 'D' && \
  132. (s)->Buffer[5] == 'e' && \
  133. (s)->Buffer[6] == 'v' && \
  134. (s)->Buffer[7] == 'i' && \
  135. (s)->Buffer[8] == 'c' && \
  136. (s)->Buffer[9] == 'e' && \
  137. (s)->Buffer[10] == 's' && \
  138. (s)->Buffer[11] == '\\' && \
  139. (s)->Buffer[12] >= 'A' && \
  140. (s)->Buffer[12] <= 'Z' && \
  141. (s)->Buffer[13] == ':')
  142. //
  143. // Macro that defines what a "volume name" mount point is. This macro can
  144. // be used to scan the result from QUERY_POINTS to discover which mount points
  145. // are "volume name" mount points.
  146. //
  147. #define MOUNTMGR_IS_VOLUME_NAME(s) ( \
  148. ((s)->Length == 96 || ((s)->Length == 98 && (s)->Buffer[48] == '\\')) && \
  149. (s)->Buffer[0] == '\\' && \
  150. ((s)->Buffer[1] == '?' || (s)->Buffer[1] == '\\') && \
  151. (s)->Buffer[2] == '?' && \
  152. (s)->Buffer[3] == '\\' && \
  153. (s)->Buffer[4] == 'V' && \
  154. (s)->Buffer[5] == 'o' && \
  155. (s)->Buffer[6] == 'l' && \
  156. (s)->Buffer[7] == 'u' && \
  157. (s)->Buffer[8] == 'm' && \
  158. (s)->Buffer[9] == 'e' && \
  159. (s)->Buffer[10] == '{' && \
  160. (s)->Buffer[19] == '-' && \
  161. (s)->Buffer[24] == '-' && \
  162. (s)->Buffer[29] == '-' && \
  163. (s)->Buffer[34] == '-' && \
  164. (s)->Buffer[47] == '}' \
  165. )
  166. #define MOUNTMGR_IS_DOS_VOLUME_NAME(s) ( \
  167. MOUNTMGR_IS_VOLUME_NAME(s) && \
  168. (s)->Length == 96 && \
  169. (s)->Buffer[1] == '\\' \
  170. )
  171. #define MOUNTMGR_IS_DOS_VOLUME_NAME_WB(s) ( \
  172. MOUNTMGR_IS_VOLUME_NAME(s) && \
  173. (s)->Length == 98 && \
  174. (s)->Buffer[1] == '\\' \
  175. )
  176. #define MOUNTMGR_IS_NT_VOLUME_NAME(s) ( \
  177. MOUNTMGR_IS_VOLUME_NAME(s) && \
  178. (s)->Length == 96 && \
  179. (s)->Buffer[1] == '?' \
  180. )
  181. #define MOUNTMGR_IS_NT_VOLUME_NAME_WB(s) ( \
  182. MOUNTMGR_IS_VOLUME_NAME(s) && \
  183. (s)->Length == 98 && \
  184. (s)->Buffer[1] == '?' \
  185. )
  186. //
  187. // The following IOCTL is supported by mounted devices.
  188. //
  189. #define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
  190. //
  191. // Output structure for IOCTL_MOUNTDEV_QUERY_DEVICE_NAME.
  192. //
  193. typedef struct _MOUNTDEV_NAME {
  194. USHORT NameLength;
  195. WCHAR Name[1];
  196. } MOUNTDEV_NAME, *PMOUNTDEV_NAME;
  197. //
  198. // Devices that wish to be mounted should report this GUID in
  199. // IoRegisterDeviceInterface.
  200. //
  201. DEFINE_GUID(MOUNTDEV_MOUNTED_DEVICE_GUID, 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  202. #endif