Leaked source code of windows server 2003
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.

275 lines
10 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. #define IOCTL_MOUNTMGR_SCRUB_REGISTRY CTL_CODE(MOUNTMGRCONTROLTYPE, 14, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  42. #define IOCTL_MOUNTMGR_QUERY_AUTO_MOUNT CTL_CODE(MOUNTMGRCONTROLTYPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
  43. #define IOCTL_MOUNTMGR_SET_AUTO_MOUNT CTL_CODE(MOUNTMGRCONTROLTYPE, 16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  44. //
  45. // Input structure for IOCTL_MOUNTMGR_CREATE_POINT.
  46. //
  47. typedef struct _MOUNTMGR_CREATE_POINT_INPUT {
  48. USHORT SymbolicLinkNameOffset;
  49. USHORT SymbolicLinkNameLength;
  50. USHORT DeviceNameOffset;
  51. USHORT DeviceNameLength;
  52. } MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT;
  53. //
  54. // Input structure for IOCTL_MOUNTMGR_DELETE_POINTS,
  55. // IOCTL_MOUNTMGR_QUERY_POINTS, and IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY.
  56. //
  57. typedef struct _MOUNTMGR_MOUNT_POINT {
  58. ULONG SymbolicLinkNameOffset;
  59. USHORT SymbolicLinkNameLength;
  60. ULONG UniqueIdOffset;
  61. USHORT UniqueIdLength;
  62. ULONG DeviceNameOffset;
  63. USHORT DeviceNameLength;
  64. } MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT;
  65. //
  66. // Output structure for IOCTL_MOUNTMGR_DELETE_POINTS,
  67. // IOCTL_MOUNTMGR_QUERY_POINTS, and IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY.
  68. //
  69. typedef struct _MOUNTMGR_MOUNT_POINTS {
  70. ULONG Size;
  71. ULONG NumberOfMountPoints;
  72. MOUNTMGR_MOUNT_POINT MountPoints[1];
  73. } MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS;
  74. //
  75. // Input structure for IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER.
  76. //
  77. typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET {
  78. USHORT DeviceNameLength;
  79. WCHAR DeviceName[1];
  80. } MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET;
  81. //
  82. // Output structure for IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER.
  83. //
  84. typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION {
  85. BOOLEAN DriveLetterWasAssigned;
  86. UCHAR CurrentDriveLetter;
  87. } MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION;
  88. //
  89. // Input structure for IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED and
  90. // IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED.
  91. //
  92. typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT {
  93. USHORT SourceVolumeNameOffset;
  94. USHORT SourceVolumeNameLength;
  95. USHORT TargetVolumeNameOffset;
  96. USHORT TargetVolumeNameLength;
  97. } MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT;
  98. //
  99. // Input structure for IOCTL_MOUNTMGR_CHANGE_NOTIFY.
  100. // Output structure for IOCTL_MOUNTMGR_CHANGE_NOTIFY.
  101. //
  102. typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO {
  103. ULONG EpicNumber;
  104. } MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO;
  105. //
  106. // Input structure for IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE,
  107. // IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION,
  108. // IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH, and
  109. // IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS.
  110. //
  111. typedef struct _MOUNTMGR_TARGET_NAME {
  112. USHORT DeviceNameLength;
  113. WCHAR DeviceName[1];
  114. } MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME;
  115. //
  116. // Output structure for IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH and
  117. // IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS.
  118. //
  119. typedef struct _MOUNTMGR_VOLUME_PATHS {
  120. ULONG MultiSzLength;
  121. WCHAR MultiSz[1];
  122. } MOUNTMGR_VOLUME_PATHS, *PMOUNTMGR_VOLUME_PATHS;
  123. //
  124. // Macro that defines what a "drive letter" mount point is. This macro can
  125. // be used to scan the result from QUERY_POINTS to discover which mount points
  126. // are find "drive letter" mount points.
  127. //
  128. #define MOUNTMGR_IS_DRIVE_LETTER(s) ( \
  129. (s)->Length == 28 && \
  130. (s)->Buffer[0] == '\\' && \
  131. (s)->Buffer[1] == 'D' && \
  132. (s)->Buffer[2] == 'o' && \
  133. (s)->Buffer[3] == 's' && \
  134. (s)->Buffer[4] == 'D' && \
  135. (s)->Buffer[5] == 'e' && \
  136. (s)->Buffer[6] == 'v' && \
  137. (s)->Buffer[7] == 'i' && \
  138. (s)->Buffer[8] == 'c' && \
  139. (s)->Buffer[9] == 'e' && \
  140. (s)->Buffer[10] == 's' && \
  141. (s)->Buffer[11] == '\\' && \
  142. (s)->Buffer[12] >= 'A' && \
  143. (s)->Buffer[12] <= 'Z' && \
  144. (s)->Buffer[13] == ':')
  145. //
  146. // Macro that defines what a "volume name" mount point is. This macro can
  147. // be used to scan the result from QUERY_POINTS to discover which mount points
  148. // are "volume name" mount points.
  149. //
  150. #define MOUNTMGR_IS_VOLUME_NAME(s) ( \
  151. ((s)->Length == 96 || ((s)->Length == 98 && (s)->Buffer[48] == '\\')) && \
  152. (s)->Buffer[0] == '\\' && \
  153. ((s)->Buffer[1] == '?' || (s)->Buffer[1] == '\\') && \
  154. (s)->Buffer[2] == '?' && \
  155. (s)->Buffer[3] == '\\' && \
  156. (s)->Buffer[4] == 'V' && \
  157. (s)->Buffer[5] == 'o' && \
  158. (s)->Buffer[6] == 'l' && \
  159. (s)->Buffer[7] == 'u' && \
  160. (s)->Buffer[8] == 'm' && \
  161. (s)->Buffer[9] == 'e' && \
  162. (s)->Buffer[10] == '{' && \
  163. (s)->Buffer[19] == '-' && \
  164. (s)->Buffer[24] == '-' && \
  165. (s)->Buffer[29] == '-' && \
  166. (s)->Buffer[34] == '-' && \
  167. (s)->Buffer[47] == '}' \
  168. )
  169. #define MOUNTMGR_IS_DOS_VOLUME_NAME(s) ( \
  170. MOUNTMGR_IS_VOLUME_NAME(s) && \
  171. (s)->Length == 96 && \
  172. (s)->Buffer[1] == '\\' \
  173. )
  174. #define MOUNTMGR_IS_DOS_VOLUME_NAME_WB(s) ( \
  175. MOUNTMGR_IS_VOLUME_NAME(s) && \
  176. (s)->Length == 98 && \
  177. (s)->Buffer[1] == '\\' \
  178. )
  179. #define MOUNTMGR_IS_NT_VOLUME_NAME(s) ( \
  180. MOUNTMGR_IS_VOLUME_NAME(s) && \
  181. (s)->Length == 96 && \
  182. (s)->Buffer[1] == '?' \
  183. )
  184. #define MOUNTMGR_IS_NT_VOLUME_NAME_WB(s) ( \
  185. MOUNTMGR_IS_VOLUME_NAME(s) && \
  186. (s)->Length == 98 && \
  187. (s)->Buffer[1] == '?' \
  188. )
  189. //
  190. // The following IOCTL is supported by mounted devices.
  191. //
  192. #define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
  193. //
  194. // Output structure for IOCTL_MOUNTDEV_QUERY_DEVICE_NAME.
  195. //
  196. typedef struct _MOUNTDEV_NAME {
  197. USHORT NameLength;
  198. WCHAR Name[1];
  199. } MOUNTDEV_NAME, *PMOUNTDEV_NAME;
  200. //
  201. // Devices that wish to be mounted should report this GUID in
  202. // IoRegisterDeviceInterface.
  203. //
  204. DEFINE_GUID(MOUNTDEV_MOUNTED_DEVICE_GUID, 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  205. //
  206. // Input / Output structure for querying / setting the auto-mount setting
  207. //
  208. typedef enum _MOUNTMGR_AUTO_MOUNT_STATE {
  209. Disabled = 0,
  210. Enabled
  211. } MOUNTMGR_AUTO_MOUNT_STATE;
  212. typedef struct _MOUNTMGR_QUERY_AUTO_MOUNT {
  213. MOUNTMGR_AUTO_MOUNT_STATE CurrentState;
  214. } MOUNTMGR_QUERY_AUTO_MOUNT, *PMOUNTMGR_QUERY_AUTO_MOUNT;
  215. typedef struct _MOUNTMGR_SET_AUTO_MOUNT {
  216. MOUNTMGR_AUTO_MOUNT_STATE NewState;
  217. } MOUNTMGR_SET_AUTO_MOUNT, *PMOUNTMGR_SET_AUTO_MOUNT;
  218. #endif