Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcoffpeparser.cpp File Reference

(bd6d7d4d74e34b96217388c50f14dbd0df620be6)

#include "qcoffpeparser_p.h"
#include <qendian.h>
#include <qloggingcategory.h>
#include <qnumeric.h>
#include <optional>
#include <qt_windows.h>
+ Include dependency graph for qcoffpeparser.cpp:

Go to the source code of this file.

Macros

#define peDebug   if (false) {} else QNoDebug()
 

Functions

static constexpr auto metadataSectionName () noexcept
 
QT_WARNING_POP const IMAGE_NT_HEADERS * checkNtHeaders (QByteArrayView data, const ErrorMaker &error)
 
static const IMAGE_SECTION_HEADER * findSectionTable (QByteArrayView data, const IMAGE_NT_HEADERS *ntHeader, const ErrorMaker &error)
 
static std::optional< QByteArrayViewfindStringTable (QByteArrayView data, const IMAGE_NT_HEADERS *ntHeader, const ErrorMaker &error)
 
static QLatin1StringView findSectionName (const IMAGE_SECTION_HEADER *section, QByteArrayView stringTable)
 

Variables

static constexpr bool IncludeValidityChecks = true
 
static constexpr QLatin1StringView truncatedSectionName
 
static QT_WARNING_PUSH const WORD ExpectedMachine
 
static const WORD ExpectedOptionalHeaderSignature
 

Macro Definition Documentation

◆ peDebug

#define peDebug   if (false) {} else QNoDebug()

Definition at line 33 of file qcoffpeparser.cpp.

Referenced by checkNtHeaders(), and findSectionTable().

Function Documentation

◆ checkNtHeaders()

QT_WARNING_POP const IMAGE_NT_HEADERS * checkNtHeaders ( QByteArrayView data,
const ErrorMaker & error )

Definition at line 197 of file qcoffpeparser.cpp.

References error, ExpectedMachine, ExpectedOptionalHeaderSignature, peDebug, and qMax().

+ Here is the call graph for this function:

◆ findSectionName()

static QLatin1StringView findSectionName ( const IMAGE_SECTION_HEADER * section,
QByteArrayView stringTable )
static

Definition at line 295 of file qcoffpeparser.cpp.

References QByteArrayView::data(), QByteArrayView::isEmpty(), ok, ptr(), qstrnlen(), QByteArrayView::size(), and QByteArrayView::toUInt().

+ Here is the call graph for this function:

◆ findSectionTable()

static const IMAGE_SECTION_HEADER * findSectionTable ( QByteArrayView data,
const IMAGE_NT_HEADERS * ntHeader,
const ErrorMaker & error )
static

Definition at line 242 of file qcoffpeparser.cpp.

References error, peDebug, and qAddOverflow().

+ Here is the call graph for this function:

◆ findStringTable()

static std::optional< QByteArrayView > findStringTable ( QByteArrayView data,
const IMAGE_NT_HEADERS * ntHeader,
const ErrorMaker & error )
static

Definition at line 267 of file qcoffpeparser.cpp.

References error, and qAddOverflow().

+ Here is the call graph for this function:

◆ metadataSectionName()

static constexpr auto metadataSectionName ( )
inlinestaticconstexprnoexcept

Definition at line 22 of file qcoffpeparser.cpp.

Variable Documentation

◆ ExpectedMachine

QT_WARNING_PUSH const WORD ExpectedMachine
static
Initial value:
=
IMAGE_FILE_MACHINE_UNKNOWN

Definition at line 39 of file qcoffpeparser.cpp.

Referenced by checkNtHeaders().

◆ ExpectedOptionalHeaderSignature

const WORD ExpectedOptionalHeaderSignature
static
Initial value:
=
sizeof(void*) == sizeof(quint64) ? IMAGE_NT_OPTIONAL_HDR64_MAGIC :
IMAGE_NT_OPTIONAL_HDR32_MAGIC
unsigned long long quint64
Definition qtypes.h:61

Definition at line 62 of file qcoffpeparser.cpp.

Referenced by checkNtHeaders().

◆ IncludeValidityChecks

constexpr bool IncludeValidityChecks = true
staticconstexpr

Definition at line 20 of file qcoffpeparser.cpp.

◆ truncatedSectionName

constexpr QLatin1StringView truncatedSectionName
staticconstexpr
Initial value:
=
metadataSectionName().left(sizeof(IMAGE_SECTION_HEADER::Name))
static constexpr auto metadataSectionName() noexcept

Definition at line 23 of file qcoffpeparser.cpp.