]> wimlib.net Git - wimlib/blob - include/wimlib/wof.h
test-imagex: Fix check of boot index
[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_ADD_OVERLAY ---
120  *
121  * Adds a new external backing source to a volume.
122  *
123  * DeviceType: 9 (FILE_DEVICE_FILE_SYSTEM)
124  * Access:     2 (FILE_WRITE_ACCESS)
125  * Function:   204
126  * Method:     0 (METHOD_BUFFERED)
127  *
128  * Input buffer:  'struct wof_external_info' followed by provider-specific data
129  * ('struct wim_provider_add_overlay_input' in the case of WIM).
130  *
131  * Output buffer:  Buffer large enough to receive any information resulting from
132  * the add operation.  For the WIM provider, this must be an 8 byte buffer that
133  * receives the 64-bit WIM file ID.
134  */
135 #define FSCTL_ADD_OVERLAY 0x98330
136
137 struct wim_provider_add_overlay_input {
138
139         /* Type of WIM file.  */
140         u32 wim_type;
141 #define WIM_BOOT_OS_WIM         0
142 #define WIM_BOOT_NOT_OS_WIM     1
143
144         /* Index of the image in the WIM to use??? (This doesn't really make
145          * sense, since WIM files combine streams for all images into a single
146          * table.  Set to 1 if unsure...)  */
147         u32 wim_index;
148
149         /* Byte offset of wim_file_name in this buffer, not including the
150          * preceding 'struct wof_external_info' (should be 16).  */
151         u32 wim_file_name_offset;
152
153         /* Number of bytes in wim_file_name.  */
154         u32 wim_file_name_length;
155
156         /* Full path to the WIM, e.g. "\??\d:\test-wimboot.wim".
157          * Does NOT need to be null terminated (MS docs claim otherwise).  */
158         wchar_t wim_file_name[];
159 };
160
161 #endif /* _WOF_H_ */