|
39 | 39 |
|
40 | 40 | namespace DynLibUtils { |
41 | 41 |
|
42 | | -struct Section_t |
| 42 | +struct Section_t : public CMemory // Start address of the section. |
43 | 43 | { |
44 | 44 | // Constructors. |
45 | | - Section_t(size_t nSectionSize = 0, const std::string_view& svSectionName = {}, CMemory pSectionBase = nullptr) noexcept : m_nSectionSize(nSectionSize), m_svSectionName(svSectionName), m_pBase(pSectionBase) {} // Default one. |
46 | | - Section_t(Section_t&& other) noexcept : m_nSectionSize(std::move(other.m_nSectionSize)), m_svSectionName(std::move(other.m_svSectionName)), m_pBase(std::move(other.m_pBase)) {} |
47 | | - |
48 | | - [[nodiscard]] |
49 | | - bool IsValid() const noexcept { return m_pBase.IsValid(); } |
| 45 | + Section_t(CMemory pSectionBase = nullptr, size_t nSectionSize = 0, const std::string_view& svSectionName = {}) noexcept : CMemory(pSectionBase), m_nSectionSize(nSectionSize), m_svSectionName(svSectionName) {} // Default one. |
| 46 | + Section_t(Section_t&& other) noexcept = default; |
50 | 47 |
|
51 | 48 | std::size_t m_nSectionSize; // Size of the section. |
52 | 49 | std::string m_svSectionName; // Name of the section. |
53 | | - CMemory m_pBase; // Start address of the section. |
54 | 50 | }; // struct Section_t |
55 | 51 |
|
56 | 52 | static constexpr std::size_t s_nDefaultPatternSize = 128; |
@@ -332,7 +328,7 @@ class CModule : public CMemory |
332 | 328 | if (!pSection || !pSection->IsValid()) |
333 | 329 | return DYNLIB_INVALID_MEMORY; |
334 | 330 |
|
335 | | - const std::uintptr_t base = pSection->m_pBase; |
| 331 | + const std::uintptr_t base = pSection->GetAddr(); |
336 | 332 | const std::size_t sectionSize = pSection->m_nSectionSize; |
337 | 333 | const std::size_t patternSize = svMask.size(); |
338 | 334 |
|
@@ -429,7 +425,7 @@ class CModule : public CMemory |
429 | 425 | if (!pSection || !pSection->IsValid()) |
430 | 426 | return 0; |
431 | 427 |
|
432 | | - const CMemory pBase = pSection->m_pBase; |
| 428 | + const CMemory pBase = *pSection; |
433 | 429 | const std::size_t sectionSize = pSection->m_nSectionSize; |
434 | 430 |
|
435 | 431 | CMemory pIter = pStartAddress ? pStartAddress : pBase; |
|
0 commit comments