VirtualBox

source: vbox/trunk/include/iprt/formats/wim.h@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/** @file
2 * IPRT - Windows Imaging (WIM) format.
3 */
4
5/*
6 * Copyright (C) 2022-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_formats_wim_h
37#define IPRT_INCLUDED_formats_wim_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/types.h>
43#include <iprt/assertcompile.h>
44#include <iprt/uuid.h>
45
46
47/** @defgroup grp_rt_formats_win Windows Imaging (WIM) format
48 * @ingroup grp_rt_formats
49 *
50 * Specification:
51 * http://download.microsoft.com/download/f/e/f/fefdc36e-392d-4678-9e4e-771ffa2692ab/Windows%20Imaging%20File%20Format.rtf
52 *
53 * @{ */
54
55
56/**
57 * A short WIM resource entry.
58 *
59 * This is a simplified version of the specs.
60 */
61typedef struct RESHDRDISKSHORT
62{
63 /** 0x00 - The compressed size. */
64 RT_GCC_EXTENSION
65 uint64_t cb : 56;
66 /** 0x07 - Flags, RESHDR_FLAGS_XXX. */
67 RT_GCC_EXTENSION
68 uint64_t bFlags : 8;
69 /** 0x08 - Offset.
70 * @note This is signed in the specficiation... */
71 uint64_t off;
72 /** 0x10 - The uncompressed original size.
73 * @note This is signed in the specficiation... */
74 uint64_t cbOriginal;
75} RESHDRDISKSHORT;
76AssertCompileSize(RESHDRDISKSHORT, 0x18);
77/** Pointer to a short WIM resource entry. */
78typedef RESHDRDISKSHORT *PRESHDRDISKSHORT;
79/** Pointer to a const short WIM resource entry. */
80typedef RESHDRDISKSHORT *PCRESHDRDISKSHORT;
81
82/** @name RESHDR_FLAGS_XXX
83 * @{ */
84#define RESHDR_FLAGS_FREE UINT8_C(0x01)
85#define RESHDR_FLAGS_METADATA UINT8_C(0x02)
86#define RESHDR_FLAGS_COMPRESSED UINT8_C(0x04)
87#define RESHDR_FLAGS_SPANNED UINT8_C(0x08)
88/** @} */
89
90/**
91 * WIM file header, version 1.
92 *
93 * The field names have been normalized to our coding style.
94 */
95#pragma pack(4)
96typedef struct WIMHEADERV1
97{
98 /** 0x00 - Magic value WIMHEADER_MAGIC. */
99 char szMagic[8];
100 /** 0x08 - The size of this header structure. */
101 uint32_t cbHeader;
102 /** 0x0c - The header version structure. */
103 uint32_t uVersion;
104 /** 0x10 - Flags. */
105 uint32_t fFlags;
106 /** 0x14 - ??. */
107 uint32_t cbCompression;
108 /** 0x18 - Unique identifier. */
109 RTUUID WIMGuid;
110 /** 0x28 - Part number in spanned (split) wim set. Unsplit use part number 1. */
111 uint16_t idxPartNumber;
112 /** 0x2a - Total number of parts in spanned set. */
113 uint16_t cTotalParts;
114 /** 0x2c - Number of images in the archive. */
115 uint32_t cImages;
116 /** 0x30 - Resource lookup table offset & size. */
117 RESHDRDISKSHORT OffsetTable;
118 /** 0x48 - XML data offset & size. */
119 RESHDRDISKSHORT XmlData;
120 /** 0x60 - Boot metadata offset & size. */
121 RESHDRDISKSHORT BootMetadata;
122 /** 0x78 - Bootable image index, zero if no bootable image. */
123 uint32_t idxBoot;
124 /** 0x7c - Integrity data offset & size.
125 * @note Misaligned! */
126 RESHDRDISKSHORT Integrity;
127 /** 0x94 - Reserved */
128 uint8_t abUnused[60];
129} WIMHEADERV1;
130#pragma pack()
131AssertCompileSize(WIMHEADERV1, 0xd0);
132/** Pointer to a XAR header. */
133typedef WIMHEADERV1 *PWIMHEADERV1;
134/** Pointer to a const XAR header. */
135typedef WIMHEADERV1 const *PCWIMHEADERV1;
136
137/** The WIMHEADERV1::szMagic value. */
138#define WIMHEADER_MAGIC "MSWIM\0\0"
139AssertCompile(sizeof(WIMHEADER_MAGIC) == 8);
140
141/** @name WIMHEADER_FLAGS_XXX - WINHEADERV1::fFlags.
142 * @note Specfication names these FLAG_HEADER_XXX.
143 * @{ */
144#define WIMHEADER_FLAGS_RESERVED RT_BIT_32(0)
145#define WIMHEADER_FLAGS_COMPRESSION RT_BIT_32(1)
146#define WIMHEADER_FLAGS_READONLY RT_BIT_32(2)
147#define WIMHEADER_FLAGS_SPANNED RT_BIT_32(3)
148#define WIMHEADER_FLAGS_RESOURCE_ONLY RT_BIT_32(4)
149#define WIMHEADER_FLAGS_METADATA_ONLY RT_BIT_32(5)
150#define WIMHEADER_FLAGS_WRITE_IN_PROGRESS RT_BIT_32(5)
151#define WIMHEADER_FLAGS_RP_FIX RT_BIT_32(6)
152#define WIMHEADER_FLAGS_COMPRESS_RESERVED RT_BIT_32(16)
153#define WIMHEADER_FLAGS_COMPRESS_XPRESS RT_BIT_32(17)
154#define WIMHEADER_FLAGS_COMPRESS_LZX RT_BIT_32(18)
155/** @} */
156
157/** @} */
158
159#endif /* !IPRT_INCLUDED_formats_wim_h */
160
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette