VirtualBox

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

Last change on this file since 93482 was 93482, checked in by vboxsync, 3 years ago

iprt/formats/wim.h: The WIM header. bugref:9781

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