|
| 1 | +meta: |
| 2 | + id: qt_installer_framework |
| 3 | + title: Qt Installer Framework archive |
| 4 | + application: Qt Installer Framework |
| 5 | + file-extension: exe |
| 6 | + endian: le |
| 7 | + encoding: utf-8 |
| 8 | + license: GPL-3.0 WITH Qt-GPL-exception-1.0 |
| 9 | + xref: |
| 10 | + wikidata: Q201904 |
| 11 | + |
| 12 | +doc: | |
| 13 | + Qt installer framework is a set of libs to make SFX installers. Installers usually contain 7zip-compressed archives. Obviously, Qt installer itself is built using this framework. |
| 14 | + |
| 15 | + Warning 1: KSC has a bug. It makes the computed values be int32_t. Of course their type should be either explicitly specified by a programmer or derived automatically. The workaroind is to just replace all int32_t to int64_t in sources. |
| 16 | + Warning 2: don't use this spec on Linux against Qt distribution with overcommit enabled unless you have lot of RAM (> 12 GiB). There is a severe memory leak somewhere (currently I have no idea where exactly). The leak is present in both C++ and python-compiled code. In python even if I have patched the generated source to explicitly free all the `bytes`, `BytesIO`s and `KaitaiStream` objects the leak is still present. At least it is neither in `bytes` nor in `BytesIO`. In C++ I have not patched anything but used move semantics to free the stuff since std::unique_ptr is used. The leak is still present. IDK where it is and how to fix it. |
| 17 | +
|
| 18 | +-license-header: | |
| 19 | + GNU General Public License Usage |
| 20 | + Alternatively, this file may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this file. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 21 | + |
| 22 | +
|
| 23 | +doc-ref: |
| 24 | + - https://wiki.qt.io/Qt-Installer-Framework |
| 25 | + - https://github.com/qtproject/installer-framework/blob/master/src/libs/installer/binaryformat.cpp |
| 26 | + - https://github.com/qtproject/installer-framework/blob/master/src/libs/installer/binarycontent.cpp |
| 27 | + - https://github.com/qtproject/installer-framework/blob/master/src/libs/installer/binarycontent.h |
| 28 | + |
| 29 | +params: |
| 30 | + - id: magic_cookie_offset |
| 31 | + type: u8 |
| 32 | + -orig-id: endOfBinaryContent - 8 |
| 33 | + doc: "In order to use this spec find the magic cookie [0xf8, 0x68, 0xd6, 0x99, 0x1c, 0x0a, 0x63, 0xc2] in the last MiB of file and set this param to its offset." |
| 34 | +instances: |
| 35 | + end_of_binary_content: |
| 36 | + value: magic_cookie_offset + sizeof<header::cookie_identifier> |
| 37 | + header: |
| 38 | + pos: end_of_binary_content - sizeof<header> |
| 39 | + type: header |
| 40 | +types: |
| 41 | + array: |
| 42 | + seq: |
| 43 | + - id: size |
| 44 | + type: u8 |
| 45 | + - id: value |
| 46 | + size: size |
| 47 | + string: |
| 48 | + seq: |
| 49 | + - id: size |
| 50 | + type: u8 |
| 51 | + - id: value |
| 52 | + size: size |
| 53 | + type: str |
| 54 | + header: |
| 55 | + seq: |
| 56 | + - id: meta_resources_count |
| 57 | + type: u8 |
| 58 | + -orig-id: metaResourcesCount |
| 59 | + - id: unkn |
| 60 | + type: u8 |
| 61 | + repeat: expr |
| 62 | + repeat-expr: 2 |
| 63 | + - id: cookie |
| 64 | + type: cookie_identifier |
| 65 | + -orig-id: magicCookie |
| 66 | + |
| 67 | + instances: |
| 68 | + other_stuff_size: |
| 69 | + value: 4 * sizeof<u8> |
| 70 | + doc: "meta count, offset/length collection index, marker, cookie..." |
| 71 | + binary_descriptor_offset: |
| 72 | + value: _root.end_of_binary_content - other_stuff_size |
| 73 | + -orig-id: posOfResourceCollectionsSegment |
| 74 | + binary_descriptor: |
| 75 | + io: _root._io |
| 76 | + pos: binary_descriptor_offset |
| 77 | + size: sizeof<binary_descriptor> |
| 78 | + type: binary_descriptor |
| 79 | + |
| 80 | + types: |
| 81 | + marker_identifier: |
| 82 | + seq: |
| 83 | + - id: type |
| 84 | + type: u1 |
| 85 | + enum: type |
| 86 | + - id: signature |
| 87 | + contents: [0x32, 0x02, 0x12] |
| 88 | + enums: |
| 89 | + type: |
| 90 | + 0x33: installer |
| 91 | + 0x34: uninstaller |
| 92 | + 0x35: updater |
| 93 | + 0x36: package_manager |
| 94 | + |
| 95 | + cookie_identifier: |
| 96 | + seq: |
| 97 | + - id: type |
| 98 | + type: u1 |
| 99 | + enum: type |
| 100 | + - id: signature |
| 101 | + contents: [0x68, 0xd6, 0x99, 0x1c, 0x0a, 0x63, 0xc2] |
| 102 | + enums: |
| 103 | + type: |
| 104 | + 0xf8: binary |
| 105 | + 0xf9: data |
| 106 | + |
| 107 | + range: |
| 108 | + doc-ref: https://github.com/qtproject/installer-framework/blob/cf8d5b9a650cc413dde79cf7d72da407c8993ddc/src/libs/installer/fileio.cpp#L52 |
| 109 | + seq: |
| 110 | + - id: start_read |
| 111 | + type: s8 |
| 112 | + - id: size |
| 113 | + type: s8 |
| 114 | + instances: |
| 115 | + start: |
| 116 | + value: _root.header.binary_descriptor.end_of_exectuable + start_read |
| 117 | + |
| 118 | + binary_descriptor: |
| 119 | + seq: |
| 120 | + - id: resources_count |
| 121 | + type: s8 |
| 122 | + doc: read it, but deliberately not used |
| 123 | + |
| 124 | + - id: binary_content_size |
| 125 | + type: s8 |
| 126 | + -orig-id: binaryContentSize |
| 127 | + |
| 128 | + - id: marker |
| 129 | + type: marker_identifier |
| 130 | + -orig-id: magicMarker |
| 131 | + instances: |
| 132 | + size_of_segment_descriptor: |
| 133 | + value: (_parent.meta_resources_count + 2) * sizeof<range> |
| 134 | + segments_descriptor: |
| 135 | + io: _root._io |
| 136 | + pos: _parent.binary_descriptor_offset - size_of_segment_descriptor |
| 137 | + size: size_of_segment_descriptor |
| 138 | + type: segments_descriptor |
| 139 | + end_of_exectuable: |
| 140 | + value: _parent._root.end_of_binary_content - binary_content_size |
| 141 | + |
| 142 | + types: |
| 143 | + segments_descriptor: |
| 144 | + seq: |
| 145 | + - id: resource_collections_segment |
| 146 | + type: range |
| 147 | + |
| 148 | + - id: meta_resource_segments |
| 149 | + type: range |
| 150 | + repeat: expr |
| 151 | + repeat-expr: _parent._parent.meta_resources_count |
| 152 | + -orig-id: metaResourceSegments |
| 153 | + |
| 154 | + - id: operations_segment |
| 155 | + type: range |
| 156 | + -orig-id: operationsSegment |
| 157 | + instances: |
| 158 | + collections: |
| 159 | + io: _root._io |
| 160 | + pos: resource_collections_segment.start |
| 161 | + size: resource_collections_segment.size |
| 162 | + type: collections |
| 163 | + operations: |
| 164 | + io: _root._io |
| 165 | + pos: operations_segment.start |
| 166 | + size: operations_segment.size |
| 167 | + type: operations |
| 168 | + |
| 169 | + types: |
| 170 | + operations: |
| 171 | + seq: |
| 172 | + - id: count |
| 173 | + type: u8 |
| 174 | + - id: operations |
| 175 | + type: operation |
| 176 | + repeat: expr |
| 177 | + repeat-expr: count |
| 178 | + - id: reserved |
| 179 | + type: u8 |
| 180 | + doc: read it, but deliberately not used |
| 181 | + types: |
| 182 | + operation: |
| 183 | + seq: |
| 184 | + - id: name |
| 185 | + type: string |
| 186 | + - id: xml |
| 187 | + type: string |
| 188 | + collections: |
| 189 | + seq: |
| 190 | + - id: count |
| 191 | + type: s8 |
| 192 | + -orig-id: size |
| 193 | + - id: collections |
| 194 | + type: collection |
| 195 | + repeat: expr |
| 196 | + repeat-expr: count |
| 197 | + types: |
| 198 | + collection: |
| 199 | + seq: |
| 200 | + - id: name |
| 201 | + type: string |
| 202 | + - id: segment_range |
| 203 | + type: range |
| 204 | + instances: |
| 205 | + segment: |
| 206 | + io: _root._io |
| 207 | + pos: segment_range.start |
| 208 | + size: segment_range.size |
| 209 | + type: segment |
| 210 | + types: |
| 211 | + segment: |
| 212 | + seq: |
| 213 | + - id: count |
| 214 | + type: u8 |
| 215 | + - id: resources |
| 216 | + type: resource |
| 217 | + repeat: expr |
| 218 | + repeat-expr: count |
| 219 | + types: |
| 220 | + resource: |
| 221 | + seq: |
| 222 | + - id: name |
| 223 | + type: string |
| 224 | + - id: segment |
| 225 | + type: range |
0 commit comments