From b9e2307d7a57f328a3463b998f802e3b67d0c290 Mon Sep 17 00:00:00 2001 From: Orange Date: Sun, 12 Oct 2025 19:57:47 +0300 Subject: [PATCH] Organizes PE scanner code into namespaces Refactors the PE scanner implementation to group related definitions and functions within namespaces. This improves code organization and readability, particularly for internal PE handling and scanning logic. The included link to the `linux-pe` repository served as a reference during this refactoring. --- source/utility/pe_pattern_scan.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/utility/pe_pattern_scan.cpp b/source/utility/pe_pattern_scan.cpp index 3d7d6c2..51d92cf 100644 --- a/source/utility/pe_pattern_scan.cpp +++ b/source/utility/pe_pattern_scan.cpp @@ -11,6 +11,9 @@ #include #endif +// Internal PE shit defines +// Big thx for linuxpe sources as ref +// Link: https://github.com/can1357/linux-pe namespace { constexpr std::uint16_t opt_hdr32_magic = 0x010B; @@ -178,7 +181,11 @@ namespace using NtHeaderVariant = std::variant, ImageNtHeaders>; +} +// Internal PE scanner functions +namespace +{ [[nodiscard]] std::optional get_nt_header_from_file(std::fstream& file, const DosHeader& dos_header) {