kernel32: Add a bunch of tests for protections accepted by VirtualAlloc, make it...
[wine] / include / ddk / mountmgr.h
1 /*
2  * Mount point manager definitions
3  *
4  * Copyright 2007 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef _MOUNTMGR_
22 #define _MOUNTMGR_
23
24 #define MOUNTMGRCONTROLTYPE  ((ULONG)'m')
25 #define MOUNTDEVCONTROLTYPE  ((ULONG)'M')
26
27 #if defined(__GNUC__)
28 #define MOUNTMGR_DEVICE_NAME (const WCHAR []){'\\','D','e','v','i','c','e','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0}
29 #define MOUNTMGR_DOS_DEVICE_NAME (const WCHAR []){'\\','\\','.','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0}
30 #elif defined(_MSC_VER)
31 #define MOUNTMGR_DEVICE_NAME     L"\\Device\\MountPointManager"
32 #define MOUNTMGR_DOS_DEVICE_NAME L"\\\\.\\MountPointManager"
33 #else
34 static const WCHAR MOUNTMGR_DEVICE_NAME[] = {'\\','D','e','v','i','c','e','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0};
35 static const WCHAR MOUNTMGR_DOS_DEVICE_NAME[] = {'\\','\\','.','\\','M','o','u','n','t','P','o','i','n','t','M','a','n','a','g','e','r',0};
36 #endif
37
38
39 #define IOCTL_MOUNTMGR_CREATE_POINT                CTL_CODE(MOUNTMGRCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
40 #define IOCTL_MOUNTMGR_DELETE_POINTS               CTL_CODE(MOUNTMGRCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
41 #define IOCTL_MOUNTMGR_QUERY_POINTS                CTL_CODE(MOUNTMGRCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 #define IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY        CTL_CODE(MOUNTMGRCONTROLTYPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
43 #define IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER           CTL_CODE(MOUNTMGRCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
44 #define IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS         CTL_CODE(MOUNTMGRCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
45 #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED  CTL_CODE(MOUNTMGRCONTROLTYPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
46 #define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED  CTL_CODE(MOUNTMGRCONTROLTYPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
47 #define IOCTL_MOUNTMGR_CHANGE_NOTIFY               CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS)
48 #define IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE     CTL_CODE(MOUNTMGRCONTROLTYPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
49 #define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES   CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
50 #define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
51
52 /* Wine extensions */
53 #ifdef WINE_MOUNTMGR_EXTENSIONS
54
55 #define IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 32, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
56 #define IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE  CTL_CODE(MOUNTMGRCONTROLTYPE, 33, METHOD_BUFFERED, FILE_READ_ACCESS)
57
58 struct mountmgr_unix_drive
59 {
60     ULONG  size;
61     ULONG  type;
62     WCHAR  letter;
63     USHORT mount_point_offset;
64     USHORT device_offset;
65 };
66
67 #endif
68
69 typedef struct _MOUNTMGR_CREATE_POINT_INPUT
70 {
71     USHORT SymbolicLinkNameOffset;
72     USHORT SymbolicLinkNameLength;
73     USHORT DeviceNameOffset;
74     USHORT DeviceNameLength;
75 } MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT;
76
77 typedef struct _MOUNTMGR_MOUNT_POINT
78 {
79     ULONG  SymbolicLinkNameOffset;
80     USHORT SymbolicLinkNameLength;
81     ULONG  UniqueIdOffset;
82     USHORT UniqueIdLength;
83     ULONG  DeviceNameOffset;
84     USHORT DeviceNameLength;
85 } MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT;
86
87 typedef struct _MOUNTMGR_MOUNT_POINTS
88 {
89     ULONG                Size;
90     ULONG                NumberOfMountPoints;
91     MOUNTMGR_MOUNT_POINT MountPoints[1];
92 } MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS;
93
94 typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET
95 {
96     USHORT DeviceNameLength;
97     WCHAR  DeviceName[1];
98 } MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET;
99
100 typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION
101 {
102     BOOLEAN DriveLetterWasAssigned;
103     UCHAR   CurrentDriveLetter;
104 } MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION;
105
106 typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT
107 {
108     USHORT SourceVolumeNameOffset;
109     USHORT SourceVolumeNameLength;
110     USHORT TargetVolumeNameOffset;
111     USHORT TargetVolumeNameLength;
112 } MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT;
113
114 typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO
115 {
116     ULONG EpicNumber;
117 } MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO;
118
119 typedef struct _MOUNTMGR_TARGET_NAME
120 {
121     USHORT DeviceNameLength;
122     WCHAR  DeviceName[1];
123 } MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME;
124
125 #define MOUNTMGR_IS_DRIVE_LETTER(s) \
126     ((s)->Length == 28 && \
127      (s)->Buffer[0] == '\\' && (s)->Buffer[1] == 'D'  && (s)->Buffer[2] == 'o'   && \
128      (s)->Buffer[3] == 's'  && (s)->Buffer[4] == 'D'  && (s)->Buffer[5] == 'e'   && \
129      (s)->Buffer[6] == 'v'  && (s)->Buffer[7] == 'i'  && (s)->Buffer[8] == 'c'   && \
130      (s)->Buffer[9] == 'e'  && (s)->Buffer[10] == 's' && (s)->Buffer[11] == '\\' && \
131      (s)->Buffer[12] >= 'A' && (s)->Buffer[12] <= 'Z' && (s)->Buffer[13] == ':')
132
133 #define MOUNTMGR_IS_VOLUME_NAME(s) \
134     (((s)->Length == 96 || ((s)->Length == 98 && (s)->Buffer[48] == '\\')) && \
135      (s)->Buffer[0] == '\\' && ((s)->Buffer[1] == '?' || (s)->Buffer[1] == '\\') && \
136      (s)->Buffer[2] == '?'  && (s)->Buffer[3] == '\\' && (s)->Buffer[4] == 'V'   && \
137      (s)->Buffer[5] == 'o'  && (s)->Buffer[6] == 'l'  && (s)->Buffer[7] == 'u'   && \
138      (s)->Buffer[8] == 'm'  && (s)->Buffer[9] == 'e'  && (s)->Buffer[10] == '{'  && \
139      (s)->Buffer[19] == '-' && (s)->Buffer[24] == '-' && (s)->Buffer[29] == '-'  && \
140      (s)->Buffer[34] == '-' && (s)->Buffer[47] == '}')
141
142 #endif /* _MOUNTMGR_ */