4 * Definitions for Windows Overlay File System Filter (WOF) ioctls. See
5 * http://msdn.microsoft.com/en-us/library/windows/hardware/ff540367(v=vs.85).aspx
6 * for more information.
12 #include "wimlib/types.h"
14 #define WOF_CURRENT_VERSION 1
15 #define WOF_PROVIDER_WIM 1
16 #define WIM_PROVIDER_CURRENT_VERSION 1
18 /* Identifies a backing provider for a specific overlay service version. */
19 struct wof_external_info {
21 /* Version of the overlay service supported by the backing provider.
22 * Set to WOF_CURRENT_VERSION. */
25 /* Identifier for the backing provider. Example value:
26 * WOF_PROVIDER_WIM. */
30 /* WOF reparse points can't be directly manipulated on Windows; setting the
31 * reparse data doesn't seem to work, and the WOF driver hides the reparse
32 * points so their data can't be read from Windows 8.1 and later. Use the
33 * ioctls (FSCTL_SET_EXTERNAL_BACKING, FSCTL_GET_EXTERNAL_BACKING,
34 * FSCTL_DELETE_EXTERNAL_BACKING) instead. */
37 * Format of the reparse data of WoF (Windows Overlay File System Filter)
38 * reparse points. These include WIMBoot "pointer files".
41 * - Reparse tag is 0x80000017
42 * - Don't make these if the file has no unnamed data stream, has an empty
43 * unnamed data stream, or already is a reparse point.
44 * - There is nowhere to put named data streams. They have to copied
45 * literally to the reparse point file.
47 struct wof_rpdata_disk {
48 struct wof_external_info info;
51 /* (Guess) Version of this structure --- set to 2. */
54 /* Integer ID that identifies the WIM. */
57 /* SHA1 message digest of the file's unnamed data
61 /* SHA1 message digest of the WIM's lookup table. */
62 u8 wim_lookup_table_sha1[20];
64 /* Uncompressed size of the file's unnamed data stream,
66 u64 stream_uncompressed_size;
68 /* Compressed size of the file's unnamed data stream, in
69 * bytes. If stream is stored uncompressed, set this
70 * the same as the uncompressed size. */
71 u64 stream_compressed_size;
73 /* Byte offset of the file's unnamed data stream in the
75 u64 stream_offset_in_wim;
81 /*****************************************************************************
83 * --- FSCTL_SET_EXTERNAL_BACKING ---
85 * Sets the backing source of a file.
87 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
88 * Access: 0 (FILE_ANY_ACCESS)
90 * Method: 0 (METHOD_BUFFERED)
92 * Input buffer: 'struct wof_external_info' followed by provider-specific data
93 * ('struct wim_provider_external_info' in the case of WIM).
97 #define FSCTL_SET_EXTERNAL_BACKING 0x9030C
99 struct wim_provider_external_info {
101 /* Set to WIM_PROVIDER_CURRENT_VERSION. */
104 /* 0 when WIM provider active, otherwise
105 * WIM_PROVIDER_EXTERNAL_FLAG_NOT_ACTIVE or
106 * WIM_PROVIDER_EXTERNAL_FLAG_SUSPENDED. */
109 /* Integer ID that identifies the WIM. Get this with the
110 * FSCTL_ADD_OVERLAY ioctl. */
113 /* SHA1 message digest of the file's unnamed data stream. */
114 u8 resource_hash[20];
117 /*****************************************************************************
119 * --- FSCTL_GET_EXTERNAL_BACKING ---
121 * Get external backing information for the specified file.
123 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
124 * Access: 0 (FILE_ANY_ACCESS)
126 * Method: 0 (METHOD_BUFFERED)
129 * Output buffer: 'struct wof_external_info' followed by provider-specific data
130 * ('struct wim_provider_external_info' in the case of WIM).
132 #define FSCTL_GET_EXTERNAL_BACKING 0x90310
134 /*****************************************************************************
136 * --- FSCTL_DELETE_EXTERNAL_BACKING ---
138 * Copy a file from its backing source to its volume, then disassociate it from
139 * its backing provider.
141 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
142 * Access: 0 (FILE_ANY_ACCESS)
144 * Method: 0 (METHOD_BUFFERED)
147 * Output buffer: None
149 #define FSCTL_DELETE_EXTERNAL_BACKING 0x90314
151 /*****************************************************************************
153 * --- FSCTL_ENUM_EXTERNAL_BACKING ---
155 * Enumerate externally backed files on a volume.
157 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
158 * Access: 0 (FILE_ANY_ACCESS)
160 * Method: 0 (METHOD_BUFFERED)
163 * Output buffer: A 16-byte buffer that receives the 128-bit file ID for the
164 * next externally backed file.
166 * The handle used may be either the volume handle or the handle for any file or
167 * directory on the volume.
169 * When all externally backed files on the volume have been enumerated, the
170 * function fails with ERROR_NO_MORE_FILES.
172 #define FSCTL_ENUM_EXTERNAL_BACKING 0x90318
174 /*****************************************************************************
176 * --- FSCTL_ENUM_OVERLAY ---
178 * Enumerates the volume's overlay sources from the specified provider.
180 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
181 * Access: 0 (FILE_ANY_ACCESS)
183 * Method: 3 (METHOD_NEITHER)
185 * Input buffer: 'struct wof_external_info' to specify the provider for which
186 * to enumerate the overlay sources.
188 * Output buffer: Provider-specific data. For the WIM provider, an array of
189 * 'struct wim_provider_overlay_entry'.
191 * This ioctl must be performed on the volume handle, such as \\.\C:
193 #define FSCTL_ENUM_OVERLAY 0x9031F
195 struct wim_provider_overlay_entry {
196 /* Byte offset of the next entry from the beginning of this structure,
197 * or 0 if there are no more entries. */
198 uint32_t next_entry_offset;
202 /* Identifier for the WIM file. */
203 uint64_t data_source_id;
205 /* GUID of the WIM file. */
208 /* Byte offset of the WIM's file name from the beginning of this
210 uint32_t wim_file_name_offset;
212 /* Type of WIM file: WIM_BOOT_OS_WIM or WIM_BOOT_NOT_OS_WIM. */
215 /* Index of the backing image in the WIM??? (This doesn't really make
216 * sense, since WIM files combine streams for all images into a single
220 /* 0 when WIM provider active, otherwise
221 * WIM_PROVIDER_EXTERNAL_FLAG_NOT_ACTIVE or
222 * WIM_PROVIDER_EXTERNAL_FLAG_SUSPENDED. */
225 /* Full path to the WIM in the NT device namespace, e.g.
226 * "\Device\HardDiskVolume2\test.wim". Seems to be null-terminated,
227 * although you probably shouldn't assume so. */
228 wchar_t wim_file_name[];
232 /*****************************************************************************
234 * --- FSCTL_ADD_OVERLAY ---
236 * Adds a new external backing source to a volume.
238 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
239 * Access: 2 (FILE_WRITE_ACCESS)
241 * Method: 0 (METHOD_BUFFERED)
243 * Input buffer: 'struct wof_external_info' followed by provider-specific data
244 * ('struct wim_provider_add_overlay_input' in the case of WIM).
246 * Output buffer: Buffer large enough to receive any information resulting from
247 * the add operation. For the WIM provider, this must be an 8 byte buffer that
248 * receives the 64-bit WIM file ID.
250 * This ioctl must be performed on the volume handle, such as \\.\C:
252 #define FSCTL_ADD_OVERLAY 0x98330
254 struct wim_provider_add_overlay_input {
256 /* Type of WIM file. */
258 #define WIM_BOOT_OS_WIM 0
259 #define WIM_BOOT_NOT_OS_WIM 1
261 /* Index of the image in the WIM to use??? (This doesn't really make
262 * sense, since WIM files combine streams for all images into a single
263 * table. Set to 1 if unsure...) */
266 /* Byte offset of wim_file_name in this buffer, not including the
267 * preceding 'struct wof_external_info' (should be 16). */
268 u32 wim_file_name_offset;
270 /* Number of bytes in wim_file_name. */
271 u32 wim_file_name_length;
273 /* Full path to the WIM, e.g. "\??\C:\test-wimboot.wim".
274 * Does NOT need to be null terminated (MS docs claim otherwise). */
275 wchar_t wim_file_name[];
278 /*****************************************************************************
280 * --- FSCTL_REMOVE_OVERLAY ---
282 * Removes an external backing source from a volume.
284 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
285 * Access: 2 (FILE_WRITE_ACCESS)
287 * Method: 0 (METHOD_BUFFERED)
289 * Input buffer: 'struct wof_external_info' followed by provider-specific data
290 * ('struct wim_provider_remove_overlay_input' in the case of WIM).
292 * Output buffer: None
294 * This ioctl must be performed on the volume handle, such as \\.\C:
296 #define FSCTL_REMOVE_OVERLAY 0x98334
298 struct wim_provider_remove_overlay_input {
299 /* Integer ID that identifies the WIM. */
304 /*****************************************************************************
306 * --- FSCTL_UPDATE_OVERLAY ---
308 * Updates an overlay source for a volume.
310 * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
311 * Access: 2 (FILE_WRITE_ACCESS)
313 * Method: 0 (METHOD_BUFFERED)
315 * Input buffer: 'struct wof_external_info' followed by provider-specific data
316 * ('struct wim_provider_update_overlay_input' in the case of WIM).
318 * Output buffer: None
320 * This ioctl must be performed on the volume handle, such as \\.\C:
322 #define FSCTL_UPDATE_OVERLAY 0x98338
324 struct wim_provider_update_overlay_input {
325 /* Integer ID that identifies the WIM data source. */
328 /* Byte offset of wim_file_name in this buffer, not including the
329 * preceding 'struct wof_external_info' (should be 16). */
330 u32 wim_file_name_offset;
332 /* Number of bytes in wim_file_name. */
333 u32 wim_file_name_length;
335 /* Full path to the WIM, e.g. "\??\C:\test-wimboot.wim".
336 * Does NOT need to be null terminated (MS docs claim otherwise).
337 * This WIM must be renamed from the original WIM, or at least be an
338 * identical copy of it! (Maybe the WIM's GUID field is checked.) */
339 wchar_t wim_file_name[];