/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: ProcessMap.hpp Date: 2021-6-10 Author: Reece ***/ #pragma once namespace Aurora::Process { struct PublicModule; struct ModuleMeta { AuString moduleName; AuString modulePath; AuUInt moduleBase {}; AuUInt origVa {}; }; struct PageTable { bool NX { true }; bool writable {}; bool readable {}; bool acSanity {}; }; static const auto kSectionNameStack = "STACK"; static const auto kSectionNameFile = "FILE"; static const auto kSectionNameHeap = "HEAP"; struct Section { AuUInt baseVa {}; AuUInt origVa {}; AuUInt fsOff {}; AuUInt size {}; PageTable pt; AuString name; AuWPtr moduleMeta; }; using Sections = AuList
; struct PublicModule { Sections sections; AuSPtr moduleMeta; }; /** * @brief Given a pointer to anything whatsoever looks up a section struct worth of page map data * @param pointer * @return */ AUKN_SYM AuOptional
GetSection(AuUInt pointer); /** * @brief Returns the executable module (like GetModuleHandle(NULL) on Windows) * @return */ AUKN_SYM PublicModule DumpExecutableRoot(); /** * @brief Dumps all known sections belonging to points of interest and modules * @return */ AUKN_SYM Sections DumpExecutableAll(); /** * @brief Rescans for loaded dynamic libraries, recalculates lookup tables * @return */ AUKN_SYM void TryRescanSlow(); }