]> wimlib.net Git - wimlib/blob - include/wimlib/wof.h
Remove quotes in do_load_text_file()
[wimlib] / include / wimlib / wof.h
1 /*
2  * wof.h
3  *
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.
7  */
8
9 #ifndef _WOF_H_
10 #define _WOF_H_
11
12 #include "wimlib/types.h"
13
14 #define WOF_CURRENT_VERSION     1
15 #define WOF_PROVIDER_WIM        1
16 #define WIM_PROVIDER_CURRENT_VERSION 1
17
18 /* Identifies a backing provider for a specific overlay service version.  */
19 struct wof_external_info {
20
21         /* Version of the overlay service supported by the backing provider.
22          * Set to WOF_CURRENT_VERSION.  */
23         u32 version;
24
25         /* Identifier for the backing provider.  Example value:
26          * WOF_PROVIDER_WIM.  */
27         u32 provider;
28 };
29
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.  */
35 #if 0
36 /*
37  * Format of the reparse data of WoF (Windows Overlay File System Filter)
38  * reparse points.  These include WIMBoot "pointer files".
39  *
40  * Notes:
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.
46  */
47 struct wof_rpdata_disk {
48         struct wof_external_info info;
49         union {
50                 struct {
51                         /* (Guess) Version of this structure --- set to 2.  */
52                         u64 version;
53
54                         /* Integer ID that identifies the WIM.  */
55                         u64 data_source_id;
56
57                         /* SHA1 message digest of the file's unnamed data
58                          * stream.  */
59                         u8 stream_sha1[20];
60
61                         /* SHA1 message digest of the WIM's lookup table.  */
62                         u8 wim_lookup_table_sha1[20];
63
64                         /* Uncompressed size of the file's unnamed data stream,
65                          * in bytes.  */
66                         u64 stream_uncompressed_size;
67
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;
72
73                         /* Byte offset of the file's unnamed data stream in the
74                          * WIM.  */
75                         u64 stream_offset_in_wim;
76                 } wim;
77         } provider_data;
78 };
79 #endif
80
81 /*****************************************************************************
82  *
83  * --- FSCTL_SET_EXTERNAL_BACKING ---
84  *
85  * Sets the backing source of a file.
86  *
87  * DeviceType:  9 (FILE_DEVICE_FILE_SYSTEM)
88  * Access:      0 (FILE_ANY_ACCESS)
89  * Function:    195
90  * Method:      0 (METHOD_BUFFERED)
91  *
92  * Input buffer:  'struct wof_external_info' followed by provider-specific data
93  * ('struct wim_provider_external_info' in the case of WIM).
94  *
95  * Output buffer: None
96  */
97 #define FSCTL_SET_EXTERNAL_BACKING 0x9030C
98
99 struct wim_provider_external_info {
100
101         /* Set to WIM_PROVIDER_CURRENT_VERSION.  */
102         u32 version;
103
104         /* 0 when WIM provider active, otherwise
105          * WIM_PROVIDER_EXTERNAL_FLAG_NOT_ACTIVE or
106          * WIM_PROVIDER_EXTERNAL_FLAG_SUSPENDED.  */
107         u32 flags;
108
109         /* Integer ID that identifies the WIM.  Get this with the
110          * FSCTL_ADD_OVERLAY ioctl.  */
111         u64 data_source_id;
112
113         /* SHA1 message digest of the file's unnamed data stream.  */
114         u8 resource_hash[20];
115 };
116
117 /*****************************************************************************
118  *
119  * --- FSCTL_GET_EXTERNAL_BACKING ---
120  *
121  * Get external backing information for the specified file.
122  *
123  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
124  * Access:     0 (FILE_ANY_ACCESS)
125  * Function:   196
126  * Method:     0 (METHOD_BUFFERED)
127  *
128  * Input buffer: None
129  * Output buffer:  'struct wof_external_info' followed by provider-specific data
130  * ('struct wim_provider_external_info' in the case of WIM).
131  */
132 #define FSCTL_GET_EXTERNAL_BACKING 0x90310
133
134 /*****************************************************************************
135  *
136  * --- FSCTL_DELETE_EXTERNAL_BACKING ---
137  *
138  * Copy a file from its backing source to its volume, then disassociate it from
139  * its backing provider.
140  *
141  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
142  * Access:     0 (FILE_ANY_ACCESS)
143  * Function:   197
144  * Method:     0 (METHOD_BUFFERED)
145  *
146  * Input buffer: None
147  * Output buffer: None
148  */
149 #define FSCTL_DELETE_EXTERNAL_BACKING 0x90314
150
151 /*****************************************************************************
152  *
153  * --- FSCTL_ENUM_EXTERNAL_BACKING ---
154  *
155  * Enumerate externally backed files on a volume.
156  *
157  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
158  * Access:     0 (FILE_ANY_ACCESS)
159  * Function:   198
160  * Method:     0 (METHOD_BUFFERED)
161  *
162  * Input buffer: None
163  * Output buffer: A 16-byte buffer that receives the 128-bit file ID for the
164  * next externally backed file.
165  *
166  * The handle used may be either the volume handle or the handle for any file or
167  * directory on the volume.
168  *
169  * When all externally backed files on the volume have been enumerated, the
170  * function fails with ERROR_NO_MORE_FILES.
171  */
172 #define FSCTL_ENUM_EXTERNAL_BACKING 0x90318
173
174 /*****************************************************************************
175  *
176  * --- FSCTL_ENUM_OVERLAY ---
177  *
178  * Enumerates the volume's overlay sources from the specified provider.
179  *
180  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
181  * Access:     0 (FILE_ANY_ACCESS)
182  * Function:   199
183  * Method:     3 (METHOD_NEITHER)
184  *
185  * Input buffer:  'struct wof_external_info' to specify the provider for which
186  * to enumerate the overlay sources.
187  *
188  * Output buffer:  Provider-specific data.  For the WIM provider, an array of
189  * 'struct wim_provider_overlay_entry'.
190  *
191  * This ioctl must be performed on the volume handle, such as \\.\C:
192  */
193 #define FSCTL_ENUM_OVERLAY 0x9031F
194
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;
199
200         uint32_t padding;
201
202         /* Identifier for the WIM file.  */
203         uint64_t data_source_id;
204
205         /* GUID of the WIM file.  */
206         uint8_t guid[16];
207
208         /* Byte offset of the WIM's file name from the beginning of this
209          * structure.  */
210         uint32_t wim_file_name_offset;
211
212         /* Type of WIM file: WIM_BOOT_OS_WIM or WIM_BOOT_NOT_OS_WIM.  */
213         uint32_t wim_type;
214
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
217          * table.)  */
218         uint32_t wim_index;
219
220         /* 0 when WIM provider active, otherwise
221          * WIM_PROVIDER_EXTERNAL_FLAG_NOT_ACTIVE or
222          * WIM_PROVIDER_EXTERNAL_FLAG_SUSPENDED.  */
223         uint32_t flags;
224
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[];
229 };
230
231
232 /*****************************************************************************
233  *
234  * --- FSCTL_ADD_OVERLAY ---
235  *
236  * Adds a new external backing source to a volume.
237  *
238  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
239  * Access:     2 (FILE_WRITE_ACCESS)
240  * Function:   204
241  * Method:     0 (METHOD_BUFFERED)
242  *
243  * Input buffer:  'struct wof_external_info' followed by provider-specific data
244  * ('struct wim_provider_add_overlay_input' in the case of WIM).
245  *
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.
249  *
250  * This ioctl must be performed on the volume handle, such as \\.\C:
251  */
252 #define FSCTL_ADD_OVERLAY 0x98330
253
254 struct wim_provider_add_overlay_input {
255
256         /* Type of WIM file.  */
257         u32 wim_type;
258 #define WIM_BOOT_OS_WIM         0
259 #define WIM_BOOT_NOT_OS_WIM     1
260
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...)  */
264         u32 wim_index;
265
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;
269
270         /* Number of bytes in wim_file_name.  */
271         u32 wim_file_name_length;
272
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[];
276 };
277
278 /*****************************************************************************
279  *
280  * --- FSCTL_REMOVE_OVERLAY ---
281  *
282  * Removes an external backing source from a volume.
283  *
284  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
285  * Access:     2 (FILE_WRITE_ACCESS)
286  * Function:   205
287  * Method:     0 (METHOD_BUFFERED)
288  *
289  * Input buffer:  'struct wof_external_info' followed by provider-specific data
290  * ('struct wim_provider_remove_overlay_input' in the case of WIM).
291  *
292  * Output buffer:  None
293  *
294  * This ioctl must be performed on the volume handle, such as \\.\C:
295  */
296 #define FSCTL_REMOVE_OVERLAY 0x98334
297
298 struct wim_provider_remove_overlay_input {
299         /* Integer ID that identifies the WIM.  */
300         u64 data_source_id;
301 };
302
303
304 /*****************************************************************************
305  *
306  * --- FSCTL_UPDATE_OVERLAY ---
307  *
308  * Updates an overlay source for a volume.
309  *
310  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
311  * Access:     2 (FILE_WRITE_ACCESS)
312  * Function:   206
313  * Method:     0 (METHOD_BUFFERED)
314  *
315  * Input buffer:  'struct wof_external_info' followed by provider-specific data
316  * ('struct wim_provider_update_overlay_input' in the case of WIM).
317  *
318  * Output buffer:  None
319  *
320  * This ioctl must be performed on the volume handle, such as \\.\C:
321  */
322 #define FSCTL_UPDATE_OVERLAY 0x98338
323
324 struct wim_provider_update_overlay_input {
325         /* Integer ID that identifies the WIM data source.  */
326         u64 data_source_id;
327
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;
331
332         /* Number of bytes in wim_file_name.  */
333         u32 wim_file_name_length;
334
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[];
340 };
341
342 #endif /* _WOF_H_ */