BinaryContent Class
class QInstaller::BinaryContentThe BinaryContent class handles binary information embedded into executables. More...
Header: | #include <BinaryContent> |
Static Public Members
QInstaller::BinaryLayout | binaryLayout(QFile *file, quint64 magicCookie) |
qint64 | findMagicCookie(QFile *in, quint64 magicCookie) |
void | readBinaryContent(QFile *file, QList<QInstaller::OperationBlob> *operations, QInstaller::ResourceCollectionManager *manager, qint64 *magicMarker, quint64 magicCookie) |
void | writeBinaryContent(QFile *out, const QList<QInstaller::OperationBlob> &operations, const QInstaller::ResourceCollectionManager &manager, qint64 magicMarker, quint64 magicCookie) |
Detailed Description
The following types of binary information can be embedded into executable files: Qt resources, performed operations, and resource collections.
The magic marker is a quint64
that identifies the kind of the binary: installer
or uninstaller
(maintenance tool).
The magic cookie is a quint64
describing whether the binary is the file holding just data or whether it includes the executable as well.
Member Function Documentation
[static]
QInstaller::BinaryLayout BinaryContent::binaryLayout(QFile *file, quint64 magicCookie)
Tries to read the binary layout of the file file. It starts searching from the end of the file file for the given magicCookie using findMagicCookie(). If the cookie was found, it fills a BinaryLayout structure and returns it. Throws Error on failure.
[static]
qint64 BinaryContent::findMagicCookie(QFile *in, quint64 magicCookie)
Searches for the given magic cookie magicCookie starting from the end of the file in. Returns the position of the magic cookie inside the binary. Throws Error on failure.
Note: Searches through up to 1MB of data, if smaller, through the whole file.
[static]
void BinaryContent::readBinaryContent(QFile *file, QList<QInstaller::OperationBlob> *operations, QInstaller::ResourceCollectionManager *manager, qint64 *magicMarker, quint64 magicCookie)
Reads the binary content of the given file file. It starts by reading the binary layout of the file using binaryLayout() using magicCookie. Throws Error on failure.
If operations is not 0, it is set to the performed operations from a previous run of for example the maintenance tool.
If manager is not 0, it is first cleared and then set to the resource collections embedded into the binary.
If magicMarker is not 0, it is set to the magic marker found in the binary.
[static]
void BinaryContent::writeBinaryContent(QFile *out, const QList<QInstaller::OperationBlob> &operations, const QInstaller::ResourceCollectionManager &manager, qint64 magicMarker, quint64 magicCookie)
Writes the binary content to the given file out. Throws Error on failure.
The binary content is written in the following order:
- Meta resources manager
- Operations operations
- Resource collections manager
- Magic marker magicMarker
- Magic cookie magicCookie
For more information see the BinaryLayout documentation.
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.