Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
peheaderinfo.h
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4
#
ifndef
PEHEADERINFO_H
5
#
define
PEHEADERINFO_H
6
7
#
include
<
qt_windows
.
h
>
8
9
#
include
<
QString
>
10
#
include
<
QStringList
>
11
12
QT_BEGIN_NAMESPACE
13
14
class
PeHeaderInfo {
15
public
:
16
PeHeaderInfo(
const
QString fileName);
17
18
~PeHeaderInfo();
19
20
bool
isValid();
21
22
QString errorMessage();
23
24
unsigned
wordSize();
25
26
unsigned
int
machineArch();
27
28
QStringList dependentLibs();
29
30
bool
isDebug();
31
32
private
:
33
bool
mValid =
false
;
34
QString mErrorMessage;
35
36
unsigned
int
mWordSize = 0;
37
unsigned
int
mMachineArch = 0;
38
QStringList mDependentLibs;
39
std::optional<
bool
> mIsDebug;
40
41
HANDLE mFileHandle = NULL;
42
HANDLE mFileMapHandle = NULL;
43
void
*mFileMemory =
nullptr
;
44
IMAGE_NT_HEADERS *mNtHeaders =
nullptr
;
45
46
void
releaseFileResources();
47
48
IMAGE_NT_HEADERS *getNtHeader();
49
template
<
class
ImageNtHeader>
50
QStringList readImportSections(
const
ImageNtHeader *ntHeaders);
51
template
<
class
ImageNtHeader>
52
QStringList determineDependentLibs(
const
ImageNtHeader *nth);
53
template
<
class
ImageNtHeader>
54
bool
determineDebug(
const
ImageNtHeader *nth);
55
56
static
QString stringFromRvaPtr(
const
void
*rvaPtr);
57
58
// Helper for reading out PE executable files: Find a section header for an RVA
59
// (IMAGE_NT_HEADERS64, IMAGE_NT_HEADERS32).
60
template
<
class
ImageNtHeader>
61
static
const
IMAGE_SECTION_HEADER *findSectionHeader(DWORD rva,
const
ImageNtHeader *nTHeader);
62
63
// Helper for reading out PE executable files: convert RVA to pointer (IMAGE_NT_HEADERS64, IMAGE_NT_HEADERS32).
64
template
<
class
ImageNtHeader>
65
static
const
void
*rvaToPtr(DWORD rva,
const
ImageNtHeader *nTHeader,
const
void
*imageBase);
66
67
template
<
class
ImageNtHeader>
68
static
unsigned
ntHeaderWordSize(
const
ImageNtHeader *header);
69
70
// Check for MSCV runtime (MSVCP90D.dll/MSVCP90.dll, MSVCP120D.dll/MSVCP120.dll,
71
// VCRUNTIME140D.DLL/VCRUNTIME140.DLL (VS2015) or msvcp120d_app.dll/msvcp120_app.dll).
72
enum
MsvcDebugRuntimeResult { MsvcDebugRuntime, MsvcReleaseRuntime, NoMsvcRuntime };
73
74
MsvcDebugRuntimeResult checkMsvcDebugRuntime();
75
};
76
77
class
PeHeaderInfoCache
{
78
public
:
79
PeHeaderInfoCache
() =
delete
;
80
81
static
PeHeaderInfo *
peHeaderInfo
(
const
QString &fileName);
82
};
83
84
QT_END_NAMESPACE
85
86
#
endif
// PEHEADERINFO_H
PeHeaderInfoCache
Definition
peheaderinfo.h:77
PeHeaderInfoCache::peHeaderInfo
static PeHeaderInfo * peHeaderInfo(const QString &fileName)
Definition
peheaderinfo.cpp:282
PeHeaderInfoCache::PeHeaderInfoCache
PeHeaderInfoCache()=delete
PeHeaderInfo::ntHeaderWordSize
unsigned int ntHeaderWordSize(const ImageNtHeader *header)
Definition
peheaderinfo.cpp:268
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
PeHeaderInfoMap
QMap< QString, PeHeaderInfo * > PeHeaderInfoMap
Definition
peheaderinfo.cpp:279
Q_GLOBAL_STATIC
Q_GLOBAL_STATIC(QReadWriteLock, g_updateMutex)
qtbase
src
tools
windeployqt
peheaderinfo.h
Generated on
for Qt by
1.18.0