Copy disabled (too large)
Download .txt
Showing preview only (11,290K chars total). Download the full file to get everything.
Repository: mike1k/VMPImportFixer
Branch: master
Commit: b6fef34b9066
Files: 237
Total size: 29.3 MB
Directory structure:
gitextract_6h2br1l5/
├── .gitignore
├── Main.cpp
├── README.md
├── VIFTools.cpp
├── VIFTools.hpp
├── VMPImportFixer.cpp
├── VMPImportFixer.hpp
├── VMPImportFixer.sln
├── VMPImportFixer.vcxproj
├── VMPImportFixer.vcxproj.filters
├── msc/
│ ├── Process.cpp
│ ├── Process.hpp
│ └── ScopedHandle.hpp
└── vendor/
├── pepp/
│ ├── ExportDirectory.cpp
│ ├── ExportDirectory.hpp
│ ├── FileHeader.hpp
│ ├── Image.cpp
│ ├── Image.hpp
│ ├── ImportDirectory.cpp
│ ├── ImportDirectory.hpp
│ ├── OptionalHeader.cpp
│ ├── OptionalHeader.hpp
│ ├── PEHeader.cpp
│ ├── PEHeader.hpp
│ ├── PELibrary.hpp
│ ├── PEUtil.cpp
│ ├── PEUtil.hpp
│ ├── RelocationDirectory.cpp
│ ├── RelocationDirectory.hpp
│ ├── SectionHeader.cpp
│ ├── SectionHeader.hpp
│ └── misc/
│ ├── Address.hpp
│ ├── ByteVector.hpp
│ ├── Concept.hpp
│ ├── File.cpp
│ ├── File.hpp
│ └── NonCopyable.hpp
├── spdlog/
│ ├── include/
│ │ └── spdlog/
│ │ ├── async.h
│ │ ├── async_logger-inl.h
│ │ ├── async_logger.h
│ │ ├── cfg/
│ │ │ ├── argv.h
│ │ │ ├── env.h
│ │ │ ├── helpers-inl.h
│ │ │ └── helpers.h
│ │ ├── common-inl.h
│ │ ├── common.h
│ │ ├── details/
│ │ │ ├── backtracer-inl.h
│ │ │ ├── backtracer.h
│ │ │ ├── circular_q.h
│ │ │ ├── console_globals.h
│ │ │ ├── file_helper-inl.h
│ │ │ ├── file_helper.h
│ │ │ ├── fmt_helper.h
│ │ │ ├── log_msg-inl.h
│ │ │ ├── log_msg.h
│ │ │ ├── log_msg_buffer-inl.h
│ │ │ ├── log_msg_buffer.h
│ │ │ ├── mpmc_blocking_q.h
│ │ │ ├── null_mutex.h
│ │ │ ├── os-inl.h
│ │ │ ├── os.h
│ │ │ ├── periodic_worker-inl.h
│ │ │ ├── periodic_worker.h
│ │ │ ├── registry-inl.h
│ │ │ ├── registry.h
│ │ │ ├── synchronous_factory.h
│ │ │ ├── tcp_client-windows.h
│ │ │ ├── tcp_client.h
│ │ │ ├── thread_pool-inl.h
│ │ │ ├── thread_pool.h
│ │ │ └── windows_include.h
│ │ ├── fmt/
│ │ │ ├── bin_to_hex.h
│ │ │ ├── bundled/
│ │ │ │ ├── args.h
│ │ │ │ ├── chrono.h
│ │ │ │ ├── color.h
│ │ │ │ ├── compile.h
│ │ │ │ ├── core.h
│ │ │ │ ├── format-inl.h
│ │ │ │ ├── format.h
│ │ │ │ ├── locale.h
│ │ │ │ ├── os.h
│ │ │ │ ├── ostream.h
│ │ │ │ ├── printf.h
│ │ │ │ ├── ranges.h
│ │ │ │ └── xchar.h
│ │ │ ├── chrono.h
│ │ │ ├── fmt.h
│ │ │ ├── ostr.h
│ │ │ └── xchar.h
│ │ ├── formatter.h
│ │ ├── fwd.h
│ │ ├── logger-inl.h
│ │ ├── logger.h
│ │ ├── pattern_formatter-inl.h
│ │ ├── pattern_formatter.h
│ │ ├── sinks/
│ │ │ ├── android_sink.h
│ │ │ ├── ansicolor_sink-inl.h
│ │ │ ├── ansicolor_sink.h
│ │ │ ├── base_sink-inl.h
│ │ │ ├── base_sink.h
│ │ │ ├── basic_file_sink-inl.h
│ │ │ ├── basic_file_sink.h
│ │ │ ├── daily_file_sink.h
│ │ │ ├── dist_sink.h
│ │ │ ├── dup_filter_sink.h
│ │ │ ├── hourly_file_sink.h
│ │ │ ├── mongo_sink.h
│ │ │ ├── msvc_sink.h
│ │ │ ├── null_sink.h
│ │ │ ├── ostream_sink.h
│ │ │ ├── ringbuffer_sink.h
│ │ │ ├── rotating_file_sink-inl.h
│ │ │ ├── rotating_file_sink.h
│ │ │ ├── sink-inl.h
│ │ │ ├── sink.h
│ │ │ ├── stdout_color_sinks-inl.h
│ │ │ ├── stdout_color_sinks.h
│ │ │ ├── stdout_sinks-inl.h
│ │ │ ├── stdout_sinks.h
│ │ │ ├── syslog_sink.h
│ │ │ ├── systemd_sink.h
│ │ │ ├── tcp_sink.h
│ │ │ ├── win_eventlog_sink.h
│ │ │ ├── wincolor_sink-inl.h
│ │ │ └── wincolor_sink.h
│ │ ├── spdlog-inl.h
│ │ ├── spdlog.h
│ │ ├── stopwatch.h
│ │ ├── tweakme.h
│ │ └── version.h
│ └── src/
│ ├── async.cpp
│ ├── cfg.cpp
│ ├── color_sinks.cpp
│ ├── file_sinks.cpp
│ ├── fmt.cpp
│ ├── spdlog.cpp
│ └── stdout_sinks.cpp
├── unicorn/
│ ├── include/
│ │ ├── list.h
│ │ ├── qemu.h
│ │ ├── uc_priv.h
│ │ └── unicorn/
│ │ ├── arm.h
│ │ ├── arm64.h
│ │ ├── m68k.h
│ │ ├── mips.h
│ │ ├── platform.h
│ │ ├── sparc.h
│ │ ├── unicorn.h
│ │ └── x86.h
│ └── lib/
│ └── x64/
│ └── unicorn_static.lib
├── zycore/
│ ├── include/
│ │ ├── Zycore/
│ │ │ ├── API/
│ │ │ │ ├── Memory.h
│ │ │ │ ├── Process.h
│ │ │ │ ├── Synchronization.h
│ │ │ │ ├── Terminal.h
│ │ │ │ └── Thread.h
│ │ │ ├── Allocator.h
│ │ │ ├── ArgParse.h
│ │ │ ├── Bitset.h
│ │ │ ├── Comparison.h
│ │ │ ├── Defines.h
│ │ │ ├── Format.h
│ │ │ ├── LibC.h
│ │ │ ├── List.h
│ │ │ ├── Object.h
│ │ │ ├── Status.h
│ │ │ ├── String.h
│ │ │ ├── Types.h
│ │ │ ├── Vector.h
│ │ │ ├── Zycore.h
│ │ │ └── ZycoreExportConfig.h
│ │ └── ZycoreExportConfig.h
│ └── src/
│ ├── API/
│ │ ├── Memory.c
│ │ ├── Process.c
│ │ ├── Synchronization.c
│ │ ├── Terminal.c
│ │ └── Thread.c
│ ├── Allocator.c
│ ├── ArgParse.c
│ ├── Bitset.c
│ ├── Format.c
│ ├── List.c
│ ├── String.c
│ ├── Vector.c
│ └── Zycore.c
└── zydis/
├── include/
│ ├── Zydis/
│ │ ├── Decoder.h
│ │ ├── DecoderTypes.h
│ │ ├── Formatter.h
│ │ ├── FormatterBuffer.h
│ │ ├── Generated/
│ │ │ ├── EnumISAExt.h
│ │ │ ├── EnumISASet.h
│ │ │ ├── EnumInstructionCategory.h
│ │ │ ├── EnumMnemonic.h
│ │ │ └── EnumRegister.h
│ │ ├── Internal/
│ │ │ ├── DecoderData.h
│ │ │ ├── FormatterATT.h
│ │ │ ├── FormatterBase.h
│ │ │ ├── FormatterIntel.h
│ │ │ ├── SharedData.h
│ │ │ └── String.h
│ │ ├── MetaInfo.h
│ │ ├── Mnemonic.h
│ │ ├── Register.h
│ │ ├── SharedTypes.h
│ │ ├── ShortString.h
│ │ ├── Status.h
│ │ ├── Utils.h
│ │ └── Zydis.h
│ └── ZydisExportConfig.h
├── lib/
│ ├── ReleaseX64/
│ │ ├── Zycore.lib
│ │ └── Zydis.lib
│ └── ReleaseX86/
│ ├── Zycore.lib
│ └── Zydis.lib
└── src/
├── Decoder.c
├── DecoderData.c
├── Formatter.c
├── FormatterATT.c
├── FormatterBase.c
├── FormatterBuffer.c
├── FormatterIntel.c
├── Generated/
│ ├── AccessedFlags.inc
│ ├── DecoderTables.inc
│ ├── EncodableInstructions.inc
│ ├── EnumISAExt.inc
│ ├── EnumISASet.inc
│ ├── EnumInstructionCategory.inc
│ ├── EnumMnemonic.inc
│ ├── EnumRegister.inc
│ ├── FormatterStrings.inc
│ ├── InstructionDefinitions.inc
│ ├── InstructionEncodings.inc
│ └── OperandDefinitions.inc
├── MetaInfo.c
├── Mnemonic.c
├── Register.c
├── SharedData.c
├── String.c
├── Utils.c
└── Zydis.c
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
pepp.vcxproj
pepp.vcxproj.filters
================================================
FILE: Main.cpp
================================================
#include "VMPImportFixer.hpp"
bool IsFileArchX64(std::filesystem::path path, bool* parsed = nullptr);
template<size_t BitSize>
IVMPImportFixer* VifFactory_GenerateFixer(std::string_view vmpsn) noexcept
{
return new VMPImportFixer<BitSize>(vmpsn);
}
int main(int argc, const char** argv)
{
logger = spdlog::stdout_color_mt("console");
logger->set_level(spdlog::level::debug);
logger->set_pattern("[%^%l%$] %v");
if (argc > 1)
{
std::string_view sFilePathOrProc {};
std::string_view sTargetModule {};
std::string_view sVMPSectionName { ".vmp0" };
DWORD dwProcessId { 0ul };
//
// Parse out arguments
for (int i = 1; i < argc; ++i)
{
if (_stricmp(argv[i], "-p") == 0 && (i + 1) < argc)
{
const char* szArg = argv[++i];
if (szArg[0] != '\'')
{
dwProcessId = std::atoi(szArg);
if (dwProcessId == 0)
{
logger->critical("Invalid process id '{}'", szArg);
return EXIT_FAILURE;
}
}
else
{
std::string sArgProc = std::string(szArg).substr(1, strlen(szArg) - 2);
spdlog::stopwatch sw;
//
// Search for process with the name
while ((dwProcessId = VifSearchForProcess(sArgProc)) == static_cast<DWORD>(-1))
{
if (std::chrono::duration_cast<std::chrono::milliseconds>(sw.elapsed()).count() > 10000)
{
logger->critical("Timed out searching for process {}.", sArgProc);
return EXIT_FAILURE;
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
}
if (_stricmp(argv[i], "-f") == 0 && (i + 1) < argc && dwProcessId == 0)
{
sFilePathOrProc = argv[++i];
}
if (_stricmp(argv[i], "-mod") == 0 && (i + 1) < argc)
{
sTargetModule = argv[++i];
}
if (_stricmp(argv[i], "-section") == 0 && (i + 1) < argc)
{
sVMPSectionName = argv[++i];
}
}
if (!sFilePathOrProc.empty() && std::filesystem::exists(sFilePathOrProc))
{
bool bWasParsed = false;
bool bIsArchX64 = IsFileArchX64(sFilePathOrProc, &bWasParsed);
if (bWasParsed)
{
//
// TODO: Load DLL or process into memory (LoadLibraryEx/CreateProcess), unpack and fix IAT.
}
}
else
{
if (dwProcessId != 0)
{
IVMPImportFixer* pImportFixer = nullptr;
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
BOOL bIsWow64 = FALSE;
if (hProcess == INVALID_HANDLE_VALUE)
{
logger->critical("Unable to open a handle to the process!");
return EXIT_FAILURE;
}
IsWow64Process(hProcess, &bIsWow64);
if (bIsWow64)
pImportFixer = VifFactory_GenerateFixer<32>(sVMPSectionName);
else
pImportFixer = VifFactory_GenerateFixer<64>(sVMPSectionName);
std::filesystem::create_directories("dumps");
pImportFixer->DumpInMemory(hProcess, sTargetModule);
delete pImportFixer;
pImportFixer = nullptr;
return EXIT_SUCCESS;
}
logger->critical("Invalid process!");
}
}
else
{
std::cout << "VMPImportFixer: Resolve import calls in a VMProtect'd binary (developed by github.com/mike1k)" << std::endl;
std::cout <<
"Usage: \tVMPImportFixer\n -proc \t(required) process name/process id" <<
std::endl;
std::cout << " -mod: \t(optional) names of module to dump." << std::endl;
std::cout << " -section: \t(optional) VMP section name to use if changed from default (VMP allows custom names)" << std::endl;
std::cout <<
"Example usages:\n"
"*\tVMPImportFixer -p 'test.exe'\n" <<
"*\tVMPImportFixer -p 123456 -mod vmp.dll -section .name0\n" <<
std::endl;
std::cout << std::endl;
}
return EXIT_FAILURE;
}
bool IsFileArchX64(std::filesystem::path path, bool* parsed)
{
pepp::io::File file{ path.string(), pepp::io::FILE_BINARY | pepp::io::FILE_INPUT };
if (file.GetSize() > 0)
{
std::vector<uint8_t> file_buf = file.Read();
IMAGE_DOS_HEADER* dos = (IMAGE_DOS_HEADER*)file_buf.data();
//
// We don't need arch specific as FILE_HEADER is the second member and it is the same size on both archs.
IMAGE_NT_HEADERS* nt = (IMAGE_NT_HEADERS*)(file_buf.data() + dos->e_lfanew);
if (dos->e_magic == IMAGE_DOS_SIGNATURE)
{
if (nt->Signature == IMAGE_NT_SIGNATURE)
{
if (parsed)
*parsed = true;
if (nt->FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64)
{
return true;
}
}
}
}
if (parsed)
*parsed = false;
return false;
}
================================================
FILE: README.md
================================================
# VMPImportFixer
VMPImportFixer is a tool aimed to resolve import calls in a VMProtect'd (3.x) binary.
# Information
VMPImportFixer attempts to resolve all obfuscated API calls in a VMProtect'd binary. A binary which has VMProtect's "Import Protection" option enabled will have all it's `CALL NEAR` instructions replaced with near relative call instructions (see [ImportCallObfuscator](https://github.com/mike1k/ImportCallObfuscator) for a similar method of obfuscating imports).
VMProtect usually has two different variations of import calls which seem to be chosen at random once the binary is protected. The first, being `push reg; call func`, and the other being `call func; ret/int3`.


Following these calls lead into the VMProtect section, which, by default is named `.vmp0`. Each stub can vary in complexity and size, however the concept is generally the same. Through a series of arithmetic which is used to calculate the real import address, the final operation usually sets `[rsp]`/`[esp]` to the import address before the final RET instruction.
Based on the variant of the call (`push reg; call func` or `call func; int3/ret`), the stub may increment the return address. This use of the extra byte and return address incrementing is used to break various decompilers from properly analyzing a function due to the decompiler not recognizing that the byte will be skipped over in runtime.
With this information combined, I decided to write a tool over the day that solves these calls. I was not happy with public implementations due to various reasons. One was closed-source, and seemed to be limited to a debugger, and the other lifts these stubs into a IL which seems impractical. I decided to go the emulation route as this trivially tackles the problem and supports both X86 and X86-64 flawlessly.
VMPImportFixer is an all-in-one tool; it will support X86 processes regardless of being in a X64 context. This means that there is no need for architecture dependent versions of the binary.
# Usage
```
Usage: VMPImportFixer
-p (required) process name/process id
-mod: (optional) name of module to dump.
-section: (optional) VMP section name to use if changed from default (VMP allows custom names)
```
# Examples
<details>
<summary>Images</summary>
* Before

* After

* Before

* After

</details>
# TODO
* Add support for loading binaries off the disk into a state where it can be monitored at specific stages (such as unpacking) then fixed.
* Add relocation handling on X86 binaries.
* Kernel support.
# Dependencies
* [pepp](https://github.com/mike1k/pepp)
* [Unicorn](https://github.com/unicorn-engine/unicorn)
* [Zydis](https://github.com/zyantific/zydis)
* [spdlog](https://github.com/gabime/spdlog)
# Credits
[mrexodia](https://github.com/mrexodia) for his contribution to [HookHunter](https://github.com/mike1k/HookHunter) regarding `ReadMemory` inside the `Process` class.
================================================
FILE: VIFTools.cpp
================================================
#include "VMPImportFixer.hpp"
DWORD VifSearchForProcess(std::string_view process_name) noexcept
{
PROCESSENTRY32 pe32{};
pe32.dwSize = sizeof pe32;
vif::nt::ScopedHandle hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (static_cast<HANDLE>(hSnapshot) == INVALID_HANDLE_VALUE)
return -1;
if (Process32First(hSnapshot, &pe32))
{
do
{
std::string_view this_proc = pe32.szExeFile;
if (this_proc.find(process_name) != this_proc.npos && pe32.th32ProcessID != GetCurrentProcessId())
return pe32.th32ProcessID;
} while (Process32Next(hSnapshot, &pe32));
}
return static_cast<DWORD>(-1);
}
bool VifFindModuleInProcess(HANDLE hProc, std::string_view module_name, VIFModuleInformation_t* info)
{
HMODULE hMods[1024];
DWORD cbNeeded;
unsigned int i;
if (!info)
return false;
if (EnumProcessModulesEx(hProc, hMods, sizeof(hMods), &cbNeeded, LIST_MODULES_ALL))
{
for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++)
{
TCHAR szModName[MAX_PATH];
if (GetModuleFileNameEx(hProc, hMods[i], szModName,
sizeof(szModName) / sizeof(TCHAR)))
{
MODULEINFO mdi{};
GetModuleInformation(hProc, hMods[i], &mdi, sizeof mdi);
info->module_path = szModName;
if (info->module_path.find(module_name) != std::string::npos)
{
info->base_address = (std::uint64_t)hMods[i];
info->module_size = mdi.SizeOfImage;
}
}
}
}
return info->base_address != 0;
}
bool VifFindModulesInProcess(HANDLE hProc, std::vector<VIFModuleInformation_t>& modules)
{
HMODULE hMods[1024];
DWORD cbNeeded;
unsigned int i;
if (EnumProcessModulesEx(hProc, hMods, sizeof(hMods), &cbNeeded, LIST_MODULES_ALL))
{
for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++)
{
TCHAR szModName[MAX_PATH];
// Get the full path to the module's file.
if (GetModuleFileNameEx(hProc, hMods[i], szModName,
sizeof(szModName) / sizeof(TCHAR)))
{
MODULEINFO info{};
GetModuleInformation(hProc, hMods[i], &info, sizeof info);
modules.emplace_back(szModName, (std::uint64_t)hMods[i], info.SizeOfImage);
}
}
}
return modules.size() > 0;
}
================================================
FILE: VIFTools.hpp
================================================
#pragma once
struct VIFModuleInformation_t
{
std::string module_path;
std::uint64_t base_address;
std::uint32_t module_size;
};
DWORD VifSearchForProcess(std::string_view process_name) noexcept;
bool VifFindModuleInProcess(HANDLE hProc, std::string_view module_name, VIFModuleInformation_t* info);
bool VifFindModulesInProcess(HANDLE hProc, std::vector<VIFModuleInformation_t>& modules);
================================================
FILE: VMPImportFixer.cpp
================================================
#include "VMPImportFixer.hpp"
std::shared_ptr<spdlog::logger> logger;
// Explicit templates.
template class VMPImportFixer<32>;
template class VMPImportFixer<64>;
class UnicornEngine
{
uc_engine* ptr;
public:
UnicornEngine(uc_engine* eng) noexcept
: ptr(eng)
{}
~UnicornEngine() noexcept
{
if (ptr)
uc_close(ptr);
}
};
template<size_t BitSize>
inline void VMPImportFixer<BitSize>::DumpInMemory(HANDLE hProcess, std::string_view sModName)
{
//
// Define types for the current mode.
using AddressType = pepp::detail::Image_t<BitSize>::Address_t;
using Address = pepp::Address<AddressType>;
static constexpr uc_mode EMULATION_MODE = BitSize == 32 ? UC_MODE_32 : UC_MODE_64;
static constexpr uc_x86_reg STACK_REGISTER = BitSize == 32 ? UC_X86_REG_ESP : UC_X86_REG_RSP;
static ZydisMachineMode ZY_MACHINE_MODE = BitSize == 32 ? ZYDIS_MACHINE_MODE_LONG_COMPAT_32 : ZYDIS_MACHINE_MODE_LONG_64;
static ZydisAddressWidth ZY_ADDRESS_WIDTH = BitSize == 32 ? ZYDIS_ADDRESS_WIDTH_32 : ZYDIS_ADDRESS_WIDTH_64;
//
// Initialize unicorn.
uc_engine* uc{};
uc_hook code_hook{};
uc_err err = uc_open(UC_ARCH_X86, EMULATION_MODE, &uc);
UnicornEngine _scoped_unicorn_free(uc);
if (err != UC_ERR_OK)
{
logger->critical("Unable to open Unicorn in X86-{} mode (err: {})", BitSize, err);
return;
}
if (ZyanStatus zs; !ZYAN_SUCCESS((zs = ZydisDecoderInit(&m_decoder, ZY_MACHINE_MODE, ZY_ADDRESS_WIDTH))))
{
logger->critical("Unable to initialize Zydis (err: {:X})", BitSize, zs);
return;
}
vif::nt::Process proc(hProcess);
pepp::Image<BitSize>* pTargetImg = nullptr;
if (proc.handle() == INVALID_HANDLE_VALUE)
{
return;
}
if (!VifFindModulesInProcess(hProcess, m_vecModuleList) || m_vecModuleList.empty())
{
logger->critical("Unable to fetch module list from process.");
return;
}
int Idx{}, mIdx{};
for (auto& mod : m_vecModuleList)
{
size_t nLastSize = 0;
std::unique_ptr<std::uint8_t> pModBuffer(new std::uint8_t[mod.module_size]{});
MEMORY_BASIC_INFORMATION mbi{};
//
// Loop through the module's memory and insert into the buffer.
while (VirtualQueryEx(proc.handle(), (PVOID)(mod.base_address + nLastSize), &mbi, sizeof (mbi)))
{
if (proc.ReadMemory(mbi.BaseAddress, &pModBuffer.get()[nLastSize], mbi.RegionSize))
; // logger->info("Read memory at {} with size {}", mbi.BaseAddress, mbi.RegionSize);
else
// Log the faliure, but that is all. We will still try to parse.
logger->critical("Unable to read memory at {:X}", (std::uintptr_t)mbi.BaseAddress);
nLastSize += mbi.RegionSize;
if (nLastSize >= mod.module_size)
break;
}
logger->info("Pushing module {} located @ 0x{:X}", mod.module_path, mod.base_address);
m_vecImageList.emplace_back(std::move(pepp::Image<BitSize>::FromRuntimeMemory(pModBuffer.get(), mod.module_size)));
if (m_vecImageList.back().magic() != IMAGE_DOS_SIGNATURE)
{
logger->error("Failed parsing image: {}", mod.module_path);
continue;
}
if (!sModName.empty() && mod.module_path.find(sModName) != std::string::npos)
mIdx = Idx;
++Idx;
}
for (auto &img : m_vecImageList)
{
if (!sModName.empty())
pTargetImg = &m_vecImageList[mIdx];
m_ImageMap[img.GetPEHeader().GetOptionalHeader().GetImageBase()] = &img;
}
//
// If no target module is selected, we default to the base process.
if (pTargetImg == nullptr)
pTargetImg = &m_vecImageList.front();
Address uImageBase = pTargetImg->GetPEHeader().GetOptionalHeader().GetImageBase();
logger->info("Using base address: {:X}", uImageBase.uintptr());
//
// By default, we scan the .text section by name. If the target binary for whatever reason
// has another name other than .text for it's code section, you will need to change this.
pepp::SectionHeader& secText = pTargetImg->GetSectionHeader(".text");
if (secText.GetName() == ".dummy")
{
logger->critical("Unable to find .text section!");
return;
}
logger->info("Found .text section at virtual address {:X}", secText.GetVirtualAddress());
pepp::SectionHeader& secVMP = pTargetImg->GetSectionHeader(m_strVMPSectionName);
if (secVMP.GetName() == ".dummy")
{
logger->critical("Unable to find {} section!", secVMP.GetName());
return;
}
logger->info("Found {} section at virtual address {:X}", m_strVMPSectionName, secVMP.GetVirtualAddress());
//
// Find all call sequences in the .text section.
std::vector<uint32_t> vecCallMatches =
pTargetImg->FindBinarySequence(&secText, "E8 ? ? ? ?");
if (vecCallMatches.empty())
{
logger->critical("Unable to find any call/jmp sequences in the .text section!");
return;
}
//
// Map the .text and .vmp0 sections into the emulator memory (even more overhead, but necessary)
Address uMappedTextAddress = (uImageBase + secText.GetVirtualAddress());
Address uMappedTextSize = pepp::Align4kb(secText.GetVirtualSize() + 0x1000);
err = uc_mem_map(uc, uMappedTextAddress.uintptr(), uMappedTextSize.uintptr(), UC_PROT_ALL);
if (err != UC_ERR_OK)
{
logger->critical("Could not map in .text section => uc_mem_map() failed with error: {}", err);
return;
}
err = uc_mem_write(uc, uMappedTextAddress.uintptr(), &pTargetImg->buffer()[secText.GetVirtualAddress()], secText.GetVirtualSize());
if (err != UC_ERR_OK)
{
logger->critical("Could not map in .text section => uc_mem_write() failed with error: {}", err);
return;
}
Address uMappedVmpAddress = (uImageBase + secVMP.GetVirtualAddress());
Address uMappedVmpSize = pepp::Align4kb(secVMP.GetVirtualSize() + 0x1000);
err = uc_mem_map(uc, uMappedVmpAddress.uintptr(), uMappedVmpSize.uintptr(), UC_PROT_ALL);
if (err != UC_ERR_OK)
{
logger->critical("Could not map in VMP section => uc_mem_map() failed with error: {}", err);
return;
}
err = uc_mem_write(uc, uMappedVmpAddress.uintptr(), &pTargetImg->buffer()[secVMP.GetVirtualAddress()], secVMP.GetVirtualSize());
if (err != UC_ERR_OK)
{
logger->critical("Could not map in VMP section => uc_mem_write() failed with error: {}", err);
return;
}
//
// Write the stack address and registers
auto STACK_SPACE = (uMappedVmpAddress.uintptr() + (uMappedVmpSize.uintptr() - 0x1000)) & -0x10;
uc_reg_write(uc, STACK_REGISTER, &STACK_SPACE);
//
// Temp data to hold info about resolved imports..
static std::pair<std::string, pepp::ExportData_t> ExpResolved{};
//
// We need to monitor every instruction that executes (since it seems like we cannot hook the
// exact instruction we need (RET))
auto VifCodeHook = +[](uc_engine* uc, uint64_t address, uint32_t size, void* user_data)
{
IVMPImportFixer* pUd = (IVMPImportFixer*)user_data;
uint8_t insnbuf[0xf];
uc_mem_read(uc, address, insnbuf, size);
ExpResolved.first.clear();
//
// Did we hit a RET?
if (insnbuf[0] == 0xC3 || insnbuf[0] == 0xC2)
{
//
// Real import address is stored in [sp reg]
AddressType uImportAddress{};
VIFModuleInformation_t mod{};
pepp::ExportData_t exp{};
uc_reg_read(uc, STACK_REGISTER, &uImportAddress);
uc_mem_read(uc, uImportAddress, &uImportAddress, sizeof(uImportAddress));
if (pUd->GetModuleFromAddress(uImportAddress, &mod))
{
if (!pUd->GetExportData(mod.base_address, uImportAddress - mod.base_address, &ExpResolved.second))
{
logger->critical("Could not find export from address {:X}", uImportAddress);
return;
}
ExpResolved.first = std::filesystem::path(mod.module_path).filename().string();
// logger->info("Resolved a call to {}!{}", ExpResolved.first, ExpResolved.second.name);
//
// Stop emulation so we don't get a memory fetch error.
uc_emu_stop(uc);
}
else
{
logger->critical("Could not find module from address {:X}", uImportAddress);
return;
}
}
};
if ((err=uc_hook_add(uc,
&code_hook,
UC_HOOK_CODE,
VifCodeHook,
this,
1,
0)) != UC_ERR_OK)
{
logger->critical("Could not install a code hook: {}", err);
return;
}
//
// Locations of vmp import calls
std::vector<std::pair<Address, Address>> vecVmpImportCalls{};
//
// Cache of imports that were added.
std::unordered_map<std::string, std::unordered_map<std::string, uint32_t>> mAddedImports;
for (auto match : vecCallMatches)
{
ZydisDecodedInstruction insn{};
std::uint8_t* insnbuf = &pTargetImg->buffer()[match];
if (DecodeInsn(insnbuf, insn))
{
AddressType uDestAddress
= CalculateAbsoluteAddress((uImageBase.uintptr() + match), insn);
if (uDestAddress == 0)
continue;
if (secVMP.HasVirtualAddress(uDestAddress - uImageBase.uintptr()))
{
logger->info("Found call to {} in {} @ {:X} (call to {:X})",
m_strVMPSectionName,
".text",
(AddressType)(uImageBase + match).uintptr(),
uDestAddress);
vecVmpImportCalls.emplace_back((uint64_t)match, uDestAddress);
}
}
}
for (auto& address : vecVmpImportCalls)
{
//
// Reset stack.
uc_reg_write(uc, STACK_REGISTER, &STACK_SPACE);
//
// Write the return address as if we just entered a CALL.
uintptr_t stackptr{};
uintptr_t rtnaddress{ uImageBase.uintptr() + address.first.uintptr() + 5 };
uc_reg_read(uc, STACK_REGISTER, &stackptr);
uc_mem_write(uc, stackptr, &rtnaddress, sizeof(rtnaddress));
// logger->info("Starting emulation @ {:X}", address.second.uintptr());
//
// Begin emulation.
uc_err uerr = uc_emu_start(uc, address.second.uintptr(), 0, 0, 0);
if (uerr != UC_ERR_OK)
{
logger->error("Emulation failed with error: {}", uerr);
continue;
}
if (ExpResolved.first.empty())
{
logger->error("Failed to resolve import @ emu address {:X}", address.second.uintptr());
continue;
}
std::uint32_t uImportRVA{};
std::uint64_t uImportVA{};
if (mAddedImports.find(ExpResolved.first) != mAddedImports.end() && mAddedImports[ExpResolved.first][ExpResolved.second.name])
{
uImportRVA = mAddedImports[ExpResolved.first][ExpResolved.second.name];
}
else
{
if (!pTargetImg->GetImportDirectory().HasModuleImport(ExpResolved.first, ExpResolved.second.name, &uImportRVA))
pTargetImg->GetImportDirectory().AddModuleImport(ExpResolved.first, ExpResolved.second.name, &uImportRVA);
mAddedImports[ExpResolved.first][ExpResolved.second.name] = uImportRVA;
}
uImportVA = uImageBase.uintptr() + uImportRVA;
if (pTargetImg->buffer().deref<uint8_t>(address.first.uintptr() + 5) == 0xcc ||
pTargetImg->buffer().deref<uint8_t>(address.first.uintptr() + 5) == 0xc3)
{
std::uint8_t patch_buf[6];
patch_buf[0] = 0xff;
patch_buf[1] = 0x15;
if constexpr (BitSize == 64)
*(std::uint32_t*)(&patch_buf[2]) = (std::uint32_t)(uImportVA - (uImageBase.uintptr() + address.first.uintptr()) - 6);
else
{
*(std::uint32_t*)(&patch_buf[2]) = (std::uint32_t)(uImportVA);
}
//
// Patch in
pTargetImg->buffer().copy_data(
address.first.uintptr(),
patch_buf,
sizeof(patch_buf)
);
logger->info("Patched import call @ 0x{:X} to {}!{}",
address.first.uintptr(),
ExpResolved.first,
ExpResolved.second.name);
}
else
{
//
// push/call sequence
std::uint8_t patch_buf[6];
patch_buf[0] = 0xff;
patch_buf[1] = 0x15;
if constexpr (BitSize == 64)
*(std::uint32_t*)(&patch_buf[2]) = (std::uint32_t)(uImportVA - (uImageBase.uintptr() + (address.first.uintptr() - 1)) - 6);
else
*(std::uint32_t*)(&patch_buf[2]) = (std::uint32_t)(uImportVA);
//
// Patch in
pTargetImg->buffer().copy_data(
address.first.uintptr() - 1,
patch_buf,
sizeof(patch_buf)
);
logger->info("Patched import call @ 0x{:X} to {}!{}",
address.first.uintptr(),
ExpResolved.first,
ExpResolved.second.name);
}
}
std::string outpath = "dumps/";
if (sModName.empty())
{
outpath += std::filesystem::path(m_vecModuleList[0].module_path).filename().string() + ".fixed";
}
else
{
outpath += std::string(sModName) + ".fixed";
}
logger->info("Finished, writing to {}", outpath);
pTargetImg->WriteToFile(outpath);
}
template<size_t BitSize>
bool VMPImportFixer<BitSize>::DecodeInsn(pepp::Address<> address, ZydisDecodedInstruction& insn) const noexcept
{
return ZYAN_SUCCESS(ZydisDecoderDecodeBuffer(&m_decoder, address.as_ptr<void>(), 0xff, &insn));
}
template<size_t BitSize>
std::uintptr_t VMPImportFixer<BitSize>::CalculateAbsoluteAddress(std::uintptr_t runtime_address, ZydisDecodedInstruction& insn) const noexcept
{
std::uintptr_t result{};
if (ZYAN_SUCCESS(ZydisCalcAbsoluteAddress(&insn, &insn.operands[0], runtime_address, &result)))
return result;
return 0ull;
}
template<size_t BitSize>
bool VMPImportFixer<BitSize>::GetModuleFromAddress(std::uintptr_t ptr, VIFModuleInformation_t* pmod)
{
if (m_vecModuleList.empty())
return false;
for (auto& mod : m_vecModuleList)
{
if (ptr >= mod.base_address && ptr <= mod.base_address + mod.module_size)
{
*pmod = mod;
return true;
}
}
return false;
}
template<size_t BitSize>
bool VMPImportFixer<BitSize>::GetExportData(std::uintptr_t mod, std::uintptr_t rva, pepp::ExportData_t* exp)
{
pepp::Image<BitSize>* pImage = m_ImageMap[mod];
bool bFound = false;
if (pImage)
{
pImage->GetExportDirectory().TraverseExports([&bFound, &exp, rva](pepp::ExportData_t* tmp)
{
if (tmp->rva == rva)
{
*exp = *tmp;
bFound = true;
}
});
}
return bFound;
}
================================================
FILE: VMPImportFixer.hpp
================================================
#pragma once
//
// Emulation engine.
#include <unicorn/unicorn.h>
#include <Windows.h>
#include <psapi.h>
#include <string>
#include <string_view>
#include <map>
#include <vector>
#include <TlHelp32.h>
#include <algorithm>
#include <memory>
#include <inttypes.h>
#include <filesystem>
#pragma comment(lib, "psapi.lib")
//! PE parsing and manipulation and some other utils.
#include "msc/Process.hpp"
#include "msc/ScopedHandle.hpp"
#include <pepp/PELibrary.hpp>
//! Include Zydis disassembler
#include <zydis/include/Zydis/Zydis.h>
#include <zycore/include/Zycore/Format.h>
#include <zycore/include/Zycore/LibC.h>
//! Include spdlog
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/stopwatch.h>
#include <spdlog/fmt/bin_to_hex.h>
#include "VIFTools.hpp"
class IVMPImportFixer
{
public:
virtual ~IVMPImportFixer() = default;
virtual bool GetModuleFromAddress(std::uintptr_t ptr, VIFModuleInformation_t* mod) = 0;
virtual void DumpInMemory(HANDLE hProcess, std::string_view sModName) = 0;
virtual bool GetExportData(std::uintptr_t mod, std::uintptr_t rva, pepp::ExportData_t* exp) = 0;
};
template<size_t BitSize>
class VMPImportFixer : public pepp::msc::NonCopyable, public IVMPImportFixer
{
public:
VMPImportFixer(std::string_view vmpsn) noexcept;
void DumpInMemory(HANDLE hProcess, std::string_view sModName) final override;
//! Zydis disassemble an instruction.
bool DecodeInsn(pepp::Address<> address, ZydisDecodedInstruction& insn) const noexcept;
std::uintptr_t CalculateAbsoluteAddress(std::uintptr_t runtime_address, ZydisDecodedInstruction& insn) const noexcept;
bool GetModuleFromAddress(std::uintptr_t ptr, VIFModuleInformation_t* mod) final override;
bool GetExportData(std::uintptr_t mod, std::uintptr_t rva, pepp::ExportData_t* exp) final override;
private:
ZydisDecoder m_decoder;
std::string m_strVMPSectionName;
std::vector<VIFModuleInformation_t> m_vecModuleList;
std::vector<pepp::Image<BitSize>> m_vecImageList;
std::map<pepp::Address<>, pepp::Image<BitSize>*> m_ImageMap;
};
extern std::shared_ptr<spdlog::logger> logger;
template<size_t BitSize>
inline VMPImportFixer<BitSize>::VMPImportFixer(std::string_view vmpsn) noexcept
: m_strVMPSectionName(vmpsn)
{
}
================================================
FILE: VMPImportFixer.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31321.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VMPImportFixer", "VMPImportFixer.vcxproj", "{701E6AB3-4569-476C-8F49-C9BEACA20247}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Debug|x64.ActiveCfg = Debug|x64
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Debug|x64.Build.0 = Debug|x64
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Debug|x86.ActiveCfg = Debug|Win32
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Debug|x86.Build.0 = Debug|Win32
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Release|x64.ActiveCfg = Release|x64
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Release|x64.Build.0 = Release|x64
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Release|x86.ActiveCfg = Release|Win32
{701E6AB3-4569-476C-8F49-C9BEACA20247}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {21943CCC-6FAC-415F-9887-DF76EF36C965}
EndGlobalSection
EndGlobal
================================================
FILE: VMPImportFixer.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{701e6ab3-4569-476c-8f49-c9beaca20247}</ProjectGuid>
<RootNamespace>VMPImportFixer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)vendor;$(ProjectDir)vendor\zydis\include;$(ProjectDir)vendor\zycore\include;$(ProjectDir)vendor\spdlog\include;$(ProjectDir)vendor\unicorn\include</IncludePath>
<LibraryPath>$(ProjectDir)\vendor\zydis\lib\ReleaseX64;$(ProjectDir)vendor\unicorn\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)vendor;$(ProjectDir)vendor\zydis\include;$(ProjectDir)vendor\zycore\include;$(ProjectDir)vendor\spdlog\include;$(ProjectDir)vendor\unicorn\include</IncludePath>
<LibraryPath>$(ProjectDir)\vendor\zydis\lib\ReleaseX64;$(ProjectDir)vendor\unicorn\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Zycore.lib;Zydis.lib;unicorn_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Zycore.lib;Zydis.lib;unicorn_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="msc\Process.cpp" />
<ClCompile Include="vendor\pepp\ExportDirectory.cpp" />
<ClCompile Include="vendor\pepp\Image.cpp" />
<ClCompile Include="vendor\pepp\ImportDirectory.cpp" />
<ClCompile Include="vendor\pepp\misc\File.cpp" />
<ClCompile Include="vendor\pepp\OptionalHeader.cpp" />
<ClCompile Include="vendor\pepp\PEHeader.cpp" />
<ClCompile Include="vendor\pepp\PEUtil.cpp" />
<ClCompile Include="vendor\pepp\RelocationDirectory.cpp" />
<ClCompile Include="vendor\pepp\SectionHeader.cpp" />
<ClCompile Include="VIFTools.cpp" />
<ClCompile Include="VMPImportFixer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="msc\Process.hpp" />
<ClInclude Include="msc\ScopedHandle.hpp" />
<ClInclude Include="vendor\pepp\ExportDirectory.hpp" />
<ClInclude Include="vendor\pepp\FileHeader.hpp" />
<ClInclude Include="vendor\pepp\Image.hpp" />
<ClInclude Include="vendor\pepp\ImportDirectory.hpp" />
<ClInclude Include="vendor\pepp\misc\Address.hpp" />
<ClInclude Include="vendor\pepp\misc\ByteVector.hpp" />
<ClInclude Include="vendor\pepp\misc\Concept.hpp" />
<ClInclude Include="vendor\pepp\misc\File.hpp" />
<ClInclude Include="vendor\pepp\misc\NonCopyable.hpp" />
<ClInclude Include="vendor\pepp\OptionalHeader.hpp" />
<ClInclude Include="vendor\pepp\PEHeader.hpp" />
<ClInclude Include="vendor\pepp\PELibrary.hpp" />
<ClInclude Include="vendor\pepp\PEUtil.hpp" />
<ClInclude Include="vendor\pepp\RelocationDirectory.hpp" />
<ClInclude Include="vendor\pepp\SectionHeader.hpp" />
<ClInclude Include="VIFTools.hpp" />
<ClInclude Include="VMPImportFixer.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: VMPImportFixer.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="VMPImportFixer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="msc\Process.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\misc\File.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\ExportDirectory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\Image.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\ImportDirectory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\OptionalHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\PEHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\PEUtil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\RelocationDirectory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vendor\pepp\SectionHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="VIFTools.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="VMPImportFixer.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="msc\Process.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="msc\ScopedHandle.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\misc\Address.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\misc\ByteVector.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\misc\Concept.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\misc\File.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\misc\NonCopyable.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\ExportDirectory.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\FileHeader.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\Image.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\ImportDirectory.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\OptionalHeader.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\PEHeader.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\PELibrary.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\PEUtil.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\RelocationDirectory.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vendor\pepp\SectionHeader.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VIFTools.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
================================================
FILE: msc/Process.cpp
================================================
#include <Windows.h>
#include "Process.hpp"
using namespace vif::nt;
Process::Process(std::uint32_t processId) noexcept
: m_processId(processId)
{
}
Process::Process(HANDLE processHandle) noexcept
: m_handle(processHandle), m_processId(GetProcessId(processHandle))
{
}
bool Process::CreateHandle(std::uint32_t flags) noexcept
{
m_handle = OpenProcess(flags, FALSE, m_processId);
return m_handle != INVALID_HANDLE_VALUE;
}
bool Process::CreateHandle(std::uint32_t processId, std::uint32_t flags) noexcept
{
m_processId = processId;
m_handle = OpenProcess(flags, FALSE, m_processId);
return m_handle != INVALID_HANDLE_VALUE;
}
// ReadProcessMemory will fail if the page has PAGE_NOACCESS or PAGE_GUARD, so try to change the protection and then read
static bool ReadPage(HANDLE handle, LPVOID address, LPVOID buffer, std::size_t size, SIZE_T* bytesRead)
{
if (!ReadProcessMemory(handle, address, buffer, size, bytesRead))
{
DWORD oldProtect = 0;
if (!VirtualProtectEx(handle, address, size, PAGE_READONLY, &oldProtect))
{
return false;
}
auto result = !!ReadProcessMemory(handle, address, buffer, size, bytesRead);
VirtualProtectEx(handle, address, size, oldProtect, &oldProtect);
return result;
}
return true;
}
bool Process::ReadMemory(pepp::Address<> address, void* buffer, std::size_t size) noexcept
{
if (m_handle == INVALID_HANDLE_VALUE || !buffer || !size)
return false;
// Read page-by-page to maximize the likelyhook of reading successfully
std::size_t bytesRead = 0;
constexpr std::uintptr_t PAGE_SIZE = 0x1000;
std::uintptr_t offset = 0;
std::uintptr_t requestedSize = size;
std::uintptr_t sizeLeftInFirstPage = PAGE_SIZE - (address.uintptr() & (PAGE_SIZE - 1));
std::uintptr_t readSize = min(sizeLeftInFirstPage, requestedSize);
while (readSize)
{
SIZE_T bytesReadSafe = 0;
auto readSuccess = ReadPage(m_handle, (PVOID)(address.uintptr() + offset), (PBYTE)buffer + offset, readSize, &bytesReadSafe);
bytesRead += bytesReadSafe;
if (!readSuccess)
break;
offset += readSize;
requestedSize -= readSize;
readSize = min(PAGE_SIZE, requestedSize);
}
auto success = bytesRead == size;
SetLastError(success ? ERROR_SUCCESS : ERROR_PARTIAL_COPY);
return success;
}
bool Process::WriteMemory(pepp::Address<> address, void* buffer, std::size_t size) noexcept
{
if (m_handle == INVALID_HANDLE_VALUE)
return false;
return static_cast<bool>(WriteProcessMemory(m_handle, address.as_ptr<void>(), buffer, size, nullptr));
}
================================================
FILE: msc/Process.hpp
================================================
#pragma once
#include <pepp/misc/Address.hpp>
#include "ScopedHandle.hpp"
#include <pepp/misc/NonCopyable.hpp>
namespace vif::nt
{
class Process : pepp::msc::NonCopyable
{
public:
Process() = default;
Process(std::uint32_t processId) noexcept;
Process(HANDLE processHandle) noexcept;
//! Create a handle to the process
//! - returns true or false depending OpenProcess status
bool CreateHandle(std::uint32_t flags) noexcept;
bool CreateHandle(std::uint32_t processId, std::uint32_t flags) noexcept;
//! Read memory
bool ReadMemory(pepp::Address<> address, void* buffer, std::size_t size) noexcept;
//! Write memory
bool WriteMemory(pepp::Address<> address, void* buffer, std::size_t size) noexcept;
//! Get handle pointer
HANDLE handle() noexcept { return m_handle.handle(); }
private:
std::uint16_t m_processId = 0;
vif::nt::ScopedHandle m_handle;
};
}
================================================
FILE: msc/ScopedHandle.hpp
================================================
#pragma once
#include <pepp/misc/NonCopyable.hpp>
namespace vif::nt
{
class ScopedHandle : pepp::msc::NonCopyable
{
HANDLE m_handle = INVALID_HANDLE_VALUE;
public:
ScopedHandle() = default;
ScopedHandle(HANDLE handle)
: m_handle(handle ? handle : INVALID_HANDLE_VALUE)
{
}
~ScopedHandle()
{
if (m_handle != INVALID_HANDLE_VALUE)
CloseHandle(m_handle);
}
operator HANDLE () noexcept
{
return m_handle;
}
HANDLE handle() noexcept
{
return m_handle;
}
LPHANDLE lphandle() noexcept
{
return &m_handle;
}
void operator=(HANDLE rhs) noexcept
{
if (m_handle != INVALID_HANDLE_VALUE)
CloseHandle(m_handle);
m_handle = rhs ? rhs : INVALID_HANDLE_VALUE;
}
};
}
================================================
FILE: vendor/pepp/ExportDirectory.cpp
================================================
#include "PELibrary.hpp"
using namespace pepp;
template class ExportDirectory<32>;
template class ExportDirectory<64>;
template<unsigned int bitsize>
ExportData_t ExportDirectory<bitsize>::GetExport(std::uint32_t idx, bool demangle /*= true*/) const
{
if (!IsPresent())
return {};
if (idx < GetNumberOfNames()) {
std::uint8_t* base{};
std::uint32_t funcAddresses{};
std::uint32_t funcNames{};
std::uint32_t funcOrdinals{};
std::uint32_t funcNamesOffset{};
mem::ByteVector const* buffer{};
funcOrdinals = m_image->GetPEHeader().RvaToOffset(GetAddressOfNameOrdinals());
uint16_t rlIdx = m_image->buffer().deref<uint16_t>(funcOrdinals + (idx * sizeof uint16_t));
funcAddresses = m_image->GetPEHeader().RvaToOffset(GetAddressOfFunctions() + sizeof(std::uint32_t) * rlIdx);
funcNames = m_image->GetPEHeader().RvaToOffset(GetAddressOfNames() + sizeof(std::uint32_t) * idx);
funcNamesOffset = m_image->GetPEHeader().RvaToOffset(m_image->buffer().deref<uint32_t>(funcNames));
if (funcAddresses && funcNames && funcOrdinals)
{
return
{
demangle ? DemangleName(m_image->buffer().as<char*>(funcNamesOffset)) : m_image->buffer().as<char*>(funcNamesOffset),
m_image->buffer().deref<uint32_t>(funcAddresses),
rlIdx
};
}
}
return {};
}
template<unsigned int bitsize>
void ExportDirectory<bitsize>::TraverseExports(const std::function<void(ExportData_t*)>& cb_func)
{
for (int i = 0; i < GetNumberOfNames(); i++)
{
ExportData_t data = GetExport(i);
if (data.rva != 0)
cb_func(&data);
}
}
template<unsigned int bitsize>
bool ExportDirectory<bitsize>::IsPresent() const noexcept
{
return m_image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_EXPORT).Size > 0;
}
template<unsigned int bitsize>
void ExportDirectory<bitsize>::AddExport(std::string_view name, std::uint32_t rva)
{
// TODO
}
================================================
FILE: vendor/pepp/ExportDirectory.hpp
================================================
#pragma once
#include <functional>
namespace pepp
{
struct ExportData_t
{
std::string name{};
std::uint32_t rva = 0;
std::uint32_t ordinal = 0xffffffff;
};
template<unsigned int bitsize>
class ExportDirectory : public pepp::msc::NonCopyable
{
friend class Image<32>;
friend class Image<64>;
Image<bitsize>* m_image;
detail::Image_t<>::ExportDirectory_t *m_base;
public:
ExportData_t GetExport(std::uint32_t idx, bool demangle = true) const;
void AddExport(std::string_view name, std::uint32_t rva);
void TraverseExports(const std::function<void(ExportData_t*)>& cb_func);
bool IsPresent() const noexcept;
void SetNumberOfFunctions(std::uint32_t num) {
m_base->NumberOfFunctions = num;
}
std::uint32_t GetNumberOfFunctions() const {
return m_base->NumberOfFunctions;
}
void SetNumberOfNames(std::uint32_t num) {
m_base->NumberOfNames = num;
}
std::uint32_t GetNumberOfNames() const {
return m_base->NumberOfNames;
}
void SetCharacteristics(std::uint32_t chrs) {
m_base->Characteristics = chrs;
}
std::uint32_t GetCharacteristics() const {
return m_base->Characteristics;
}
void SetTimeDateStamp(std::uint32_t TimeDateStamp) {
m_base->TimeDateStamp = TimeDateStamp;
}
std::uint32_t GetTimeDateStamp() const {
return m_base->TimeDateStamp;
}
void SetAddressOfFunctions(std::uint32_t AddressOfFunctions) {
m_base->AddressOfFunctions = AddressOfFunctions;
}
std::uint32_t GetAddressOfFunctions() const {
return m_base->AddressOfFunctions;
}
void SetAddressOfNames(std::uint32_t AddressOfNames) {
m_base->AddressOfNames = AddressOfNames;
}
std::uint32_t GetAddressOfNames() const {
return m_base->AddressOfNames;
}
void SetAddressOfNameOrdinals(std::uint32_t AddressOfNamesOrdinals) {
m_base->AddressOfNameOrdinals = AddressOfNamesOrdinals;
}
std::uint32_t GetAddressOfNameOrdinals() const {
return m_base->AddressOfNameOrdinals;
}
constexpr std::size_t size() const {
return sizeof(decltype(*m_base));
}
private:
//! Setup the directory
void _setup(Image<bitsize>* image) {
m_image = image;
m_base = reinterpret_cast<decltype(m_base)>(
&image->base()[image->GetPEHeader().RvaToOffset(
image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_EXPORT).VirtualAddress)]);
}
};
}
================================================
FILE: vendor/pepp/FileHeader.hpp
================================================
#pragma once
namespace pepp
{
enum class PEMachine
{
MACHINE_I386 = 0x14c,
MACHINE_IA64 = 0x200,
MACHINE_AMD64 = 0x8664
};
class FileHeader : pepp::msc::NonCopyable
{
friend class PEHeader<32>;
friend class PEHeader<64>;
IMAGE_FILE_HEADER* m_base;
public:
FileHeader()
{
}
void SetMachine(PEMachine machine) {
m_base->Machine = static_cast<std::uint16_t>(machine);
}
PEMachine GetMachine() const {
return static_cast<PEMachine>(m_base->Machine);
}
void SetNumberOfSections(std::uint16_t numSections) {
m_base->NumberOfSections = numSections;
}
std::uint16_t GetNumberOfSections() const {
return m_base->NumberOfSections;
}
void SetTimeDateStamp(std::uint32_t dwTimeDateStamp) {
m_base->TimeDateStamp = dwTimeDateStamp;
}
std::uint32_t GetTimeDateStamp() const {
return m_base->TimeDateStamp;
}
void SetPointerToSymbolTable(std::uint32_t dwPointerToSymbolTable) {
m_base->PointerToSymbolTable = dwPointerToSymbolTable;
}
std::uint32_t GetPointerToSymbolTable() const {
return m_base->PointerToSymbolTable;
}
void SetNumberOfSymbols(std::uint32_t numSymbols) {
m_base->NumberOfSymbols = numSymbols;
}
std::uint32_t GetNumberOfSymbols() const {
return m_base->NumberOfSymbols;
}
void SetSizeOfOptionalHeader(std::uint16_t size) {
m_base->SizeOfOptionalHeader = size;
}
std::uint16_t GetSizeOfOptionalHeader() const {
return m_base->SizeOfOptionalHeader;
}
void SetCharacteristics(std::uint16_t chars) {
m_base->Characteristics = chars;
}
std::uint16_t GetCharacteristics() const {
return m_base->Characteristics;
}
IMAGE_FILE_HEADER* native() const {
return m_base;
}
private:
template<unsigned int bitsize>
void _setup(Image<bitsize>* image) {
m_base = &image->GetPEHeader().native()->FileHeader;
}
};
}
================================================
FILE: vendor/pepp/Image.cpp
================================================
#include "PELibrary.hpp"
#include "PEUtil.hpp"
#include <algorithm>
using namespace pepp;
// Explicit templates.
template class Image<32>;
template class Image<64>;
template<unsigned int bitsize>
Image<bitsize>::Image()
{
}
template<unsigned int bitsize>
Image<bitsize>::Image(const Image& rhs)
: m_fileName(rhs.m_fileName)
//, m_imageBuffer(std::move(rhs.m_imageBuffer)) -- bad
, m_imageBuffer(rhs.m_imageBuffer)
{
// Ensure that the file was read.
assert(m_imageBuffer.size() > 0);
// Validate there is a valid MZ signature.
_validate();
}
template<unsigned int bitsize>
constexpr PEMachine Image<bitsize>::GetMachine() const
{
if constexpr (bitsize == 32)
return PEMachine::MACHINE_I386;
return PEMachine::MACHINE_AMD64;
}
template<unsigned int bitsize>
Image<bitsize>::Image(std::string_view filepath)
: m_fileName(filepath)
{
io::File file(m_fileName, io::FILE_INPUT | io::FILE_BINARY);
std::vector<uint8_t> data{ file.Read() };
m_imageBuffer.resize(data.size());
m_imageBuffer.copy_data(0, data.data(), data.size());
// Ensure that the file was read.
assert(m_imageBuffer.size() > 0);
// Validate there is a valid MZ signature.
_validate();
}
template<unsigned int bitsize>
Image<bitsize>::Image(const void* data, std::size_t size)
{
m_imageBuffer.resize(size);
std::memcpy(&m_imageBuffer[0], data, size);
// Validate there is a valid MZ signature.
_validate();
}
template<unsigned int bitsize>
[[nodiscard]] Image<bitsize> Image<bitsize>::FromRuntimeMemory(void* data, std::size_t size) noexcept
{
Image<bitsize> _r;
_r.m_MZHeader = reinterpret_cast<detail::Image_t<>::MZHeader_t*>(data);
// Valid MZ tag?
assert(_r.magic() == IMAGE_DOS_SIGNATURE);
// Setup the PE header data.
_r.m_PEHeader._setup(&_r);
assert(_r.m_PEHeader.IsTaggedPE());
_r.m_imageBuffer.resize(size);
std::memcpy(&_r.m_imageBuffer[0], data, _r.m_imageBuffer.size());
//
// Okay just _validate now.
_r._validate();
//
// It's runtime, so map it.
_r.SetMapped();
_r._validate();
return _r;
}
template<unsigned int bitsize>
bool Image<bitsize>::SetFromRuntimeMemory(void* data, std::size_t size) noexcept
{
m_MZHeader = reinterpret_cast<detail::Image_t<>::MZHeader_t*>(data);
// Valid MZ tag?
assert(magic() == IMAGE_DOS_SIGNATURE);
// Setup the PE header data.
m_PEHeader._setup(this);
assert(m_PEHeader.IsTaggedPE());
m_imageBuffer.resize(size);
std::memcpy(&m_imageBuffer[0], data, m_imageBuffer.size());
//
// Okay just _validate now.
_validate();
//
// It's runtime, so map it.
SetMapped();
_validate();
return true;
}
template<unsigned int bitsize>
bool Image<bitsize>::HasDataDirectory(PEDirectoryEntry entry)
{
return GetPEHeader().GetOptionalHeader().GetDataDirectory(entry).Size > 0;
}
template<unsigned int bitsize>
void Image<bitsize>::WriteToFile(std::string_view filepath)
{
io::File file(filepath, io::FILE_OUTPUT | io::FILE_BINARY);
file.Write(m_imageBuffer);
}
template<unsigned int bitsize>
void Image<bitsize>::_validate()
{
m_MZHeader = reinterpret_cast<detail::Image_t<>::MZHeader_t*>(base());
// Valid MZ tag?
assert(magic() == IMAGE_DOS_SIGNATURE);
// Setup the PE header data.
m_PEHeader._setup(this);
assert(m_PEHeader.IsTaggedPE());
// Setup sections
m_rawSectionHeaders = (m_PEHeader.m_PEHdr ? reinterpret_cast<SectionHeader*>(IMAGE_FIRST_SECTION(m_PEHeader.m_PEHdr)) : nullptr);
assert(m_rawSectionHeaders != nullptr);
//
// Ensure the Image class was constructed with the correct bitsize.
if constexpr (bitsize == 32)
{
assert(m_PEHeader.GetOptionalHeader().GetMagic() == PEMagic::HDR_32);
}
else if constexpr (bitsize == 64)
{
assert(m_PEHeader.GetOptionalHeader().GetMagic() == PEMagic::HDR_64);
}
//
// Setup export directory
m_exportDirectory._setup(this);
//
// Setup import directory
m_importDirectory._setup(this);
//
// Setup reloc directory
m_relocDirectory._setup(this);
}
template<unsigned int bitsize>
bool Image<bitsize>::AppendExport(std::string_view exportName, std::uint32_t rva)
{
GetExportDirectory().AddExport(exportName, rva);
return false;
}
template<unsigned int bitsize>
bool Image<bitsize>::ExtendSection(std::string_view sectionName, std::uint32_t delta)
{
std::uint32_t fileAlignment = GetPEHeader().GetOptionalHeader().GetFileAlignment();
std::uint32_t sectAlignment = GetPEHeader().GetOptionalHeader().GetSectionAlignment();
if (fileAlignment == 0 || sectAlignment == 0 || delta == 0)
return false;
SectionHeader& header = GetSectionHeader(sectionName);
if (header.GetName() != ".dummy")
{
std::unique_ptr<uint8_t> zero_buf(new uint8_t[delta]{});
header.SetSizeOfRawData(header.GetSizeOfRawData() + delta);
header.SetVirtualSize(header.GetVirtualSize() + delta);
for (int i = 0; i < MAX_DIRECTORY_COUNT; i++)
{
auto& dir = GetPEHeader().GetOptionalHeader().GetDataDirectory(i);
if (dir.VirtualAddress == header.GetVirtualAddress())
{
dir.Size = header.GetVirtualSize();
break;
}
}
//
// Update image size
GetPEHeader().GetOptionalHeader().SetSizeOfImage(GetPEHeader().GetOptionalHeader().GetSizeOfImage() + delta);
//
// Fill in data
buffer().insert_data(header.GetPointerToRawData() + header.GetSizeOfRawData(), zero_buf.get(), delta);
//
// Re-validate the image/headers.
_validate();
return true;
}
return false;
}
template<unsigned int bitsize>
std::uint32_t Image<bitsize>::FindPadding(SectionHeader* s, std::uint8_t v, std::size_t n, std::uint32_t alignment)
{
bool bTraverseUp = s == nullptr;
std::uint32_t startOffset{};
n = pepp::Align(n, alignment);
if (s == nullptr)
s = &m_rawSectionHeaders[GetNumberOfSections() - 1];
startOffset = s->GetPointerToRawData();
std::vector<uint8_t>::iterator it = buffer().end();
if (bTraverseUp)
{
//
std::vector<uint8_t> tmpData(n, v);
for (std::uint32_t i = startOffset + s->GetSizeOfRawData(); i > n; i = Align(i - n, alignment))
{
if (memcmp(&buffer()[i - n], tmpData.data(), tmpData.size()) == 0)
{
it = buffer().begin() + (i - n);
break;
}
}
}
else
{
std::vector<uint8_t> tmpData(n, v);
for (std::uint32_t i = startOffset; i < startOffset + (buffer().size() - startOffset); i = Align(i + n, alignment))
{
if (memcmp(&buffer()[i], tmpData.data(), tmpData.size()) == 0)
{
it = buffer().begin() + (i);
break;
}
}
}
if (it == buffer().end())
return -1;
return (std::uint32_t)std::distance(buffer().begin(), it);
}
template<unsigned int bitsize>
std::uint32_t Image<bitsize>::FindZeroPadding(SectionHeader* s, std::size_t n, std::uint32_t alignment)
{
return FindPadding(s, 0x0, n, alignment);
}
template<unsigned int bitsize>
std::vector<std::uint32_t> Image<bitsize>::FindBinarySequence(SectionHeader* s, std::string_view binary_seq) const
{
constexpr auto ascii_to_byte = [](const char ch) [[msvc::forceinline]] {
if (ch >= '0' && ch <= '9')
return std::uint8_t(ch - '0');
if (ch >= 'A' && ch <= 'F')
return std::uint8_t(ch - 'A' + '\n');
return std::uint8_t(ch - 'a' + '\n');
};
std::vector<std::uint32_t> offsets{};
if (s == nullptr)
s = &m_rawSectionHeaders[GetNumberOfSections() - 1];
std::uint32_t start_offset = s->GetPointerToRawData();
std::uint32_t result = 0;
std::uint32_t match_count = 0;
for (std::uint32_t i = start_offset; i <= start_offset + s->GetSizeOfRawData(); ++i)
{
for (int c = 0; c < binary_seq.size();)
{
if (binary_seq[c] == ' ')
{
++c;
continue;
}
if (binary_seq[c] == '?')
{
++c;
++match_count;
continue;
}
if (buffer()[i + match_count++] != ((ascii_to_byte(binary_seq[c]) << 4) | ascii_to_byte(binary_seq[c + 1])))
{
result = 0;
break;
}
result = i;
c += 2;
}
if (result)
{
offsets.emplace_back(i);
i += match_count - 1;
}
match_count = 0;
result = 0;
}
return offsets;
}
template<unsigned int bitsize>
std::vector<std::pair<std::int32_t, std::uint32_t>> Image<bitsize>::FindBinarySequences(SectionHeader* s, std::initializer_list<std::pair<std::int32_t, std::string_view>> binary_seq) const
{
constexpr auto ascii_to_byte = [](const char ch) [[msvc::forceinline]] {
if (ch >= '0' && ch <= '9')
return std::uint8_t(ch - '0');
if (ch >= 'A' && ch <= 'F')
return std::uint8_t(ch - 'A' + '\n');
return std::uint8_t(ch - 'a' + '\n');
};
std::vector<std::pair<std::int32_t, std::uint32_t>> offsets{};
if (s == nullptr)
s = &m_rawSectionHeaders[GetNumberOfSections() - 1];
std::uint32_t start_offset = s->GetPointerToRawData();
std::pair<std::int32_t, std::uint32_t> result{};
std::uint32_t match_count = 0;
for (std::uint32_t i = start_offset; i <= start_offset + s->GetSizeOfRawData(); ++i)
{
for (auto const& seq : binary_seq)
{
for (int c = 0; c < seq.second.size();)
{
if (seq.second[c] == ' ')
{
++c;
continue;
}
if (seq.second[c] == '?')
{
++c;
++match_count;
continue;
}
std::uint8_t _byte = ((ascii_to_byte(seq.second[c]) << 4) | ascii_to_byte(seq.second[c + 1]));
if (buffer()[i + match_count++] != _byte)
{
result = { 0,0 };
break;
}
result = {seq.first, i};
c += 2;
}
if (result.second)
{
offsets.emplace_back(std::move(result));
break;
}
match_count = 0;
result = { 0, 0 };
}
i += std::max<int>(match_count - 1, 0);
match_count = 0;
}
return offsets;
}
template<unsigned int bitsize>
bool Image<bitsize>::AppendSection(std::string_view section_name, std::uint32_t size, std::uint32_t chrs, SectionHeader* out)
{
std::uint32_t fileAlignment = GetPEHeader().GetOptionalHeader().GetFileAlignment();
std::uint32_t sectAlignment = GetPEHeader().GetOptionalHeader().GetSectionAlignment();
if (fileAlignment == 0 || sectAlignment == 0)
return false;
std::uint32_t alignedFileSize = Align(size, fileAlignment);
std::uint32_t alignedVirtSize = Align(size, sectAlignment);
//
// Build a section (these should be the only necessary values to fill)
SectionHeader sec;
sec.SetName(section_name);
sec.SetSizeOfRawData(alignedFileSize);
sec.SetVirtualSize(alignedVirtSize);
sec.SetCharacteristics(chrs);
sec.SetVirtualAddress(GetPEHeader().GetNextSectionRva());
sec.SetPointerToRawData(GetPEHeader().GetNextSectionOffset());
//
// Update image size
GetPEHeader().GetOptionalHeader().SetSizeOfImage(GetPEHeader().GetOptionalHeader().GetSizeOfImage() + sec.GetVirtualSize());
//
// Update number of sections.
GetPEHeader().GetFileHeader().SetNumberOfSections(GetNumberOfSections() + 1);
//
// Fill in some temp data
std::vector<std::uint8_t> section_data(sec.GetSizeOfRawData());
std::fill(section_data.begin(), section_data.end(), 0x0);
//
// Add it in the raw section header
std::memcpy(&m_rawSectionHeaders[GetNumberOfSections() - 1], &sec, sizeof(SectionHeader));
if (out)
std::memcpy(out, &m_rawSectionHeaders[GetNumberOfSections() - 1], sizeof(SectionHeader));
//
// Finally, append it to the image buffer.
buffer().insert_data(sec.GetPointerToRawData(), section_data.data(), section_data.size());
//
// Re-validate the image/headers.
_validate();
return true;
}
template<unsigned int bitsize>
void pepp::Image<bitsize>::SetMapped() noexcept
{
for (std::uint16_t i = 0; i < GetNumberOfSections(); ++i)
{
SectionHeader& sec = GetSectionHeader(i);
sec.SetPointerToRawData(sec.GetVirtualAddress());
sec.SetSizeOfRawData(sec.GetVirtualSize());
}
m_mem_mapped = true;
}
================================================
FILE: vendor/pepp/Image.hpp
================================================
#pragma once
namespace pepp
{
template<unsigned int>
class PEHeader;
class SectionHeader;
template<unsigned int>
class ExportDirectory;
template<unsigned int>
class ImportDirectory;
template<unsigned int>
class RelocationDirectory;
enum SectionCharacteristics;
enum PEDirectoryEntry;
enum class PEMachine;
namespace detail
{
template<unsigned int bitsize = 0>
struct Image_t
{
using MZHeader_t = IMAGE_DOS_HEADER;
using ImportDescriptor_t = IMAGE_IMPORT_DESCRIPTOR;
using BoundImportDescriptor_t = IMAGE_BOUND_IMPORT_DESCRIPTOR;
using ResourceDirectory_t = IMAGE_RESOURCE_DIRECTORY;
using ResourceDirectoryEntry_t = IMAGE_RESOURCE_DIRECTORY_ENTRY;
using SectionHeader_t = IMAGE_SECTION_HEADER;
using FileHeader_t = IMAGE_FILE_HEADER;
using DataDirectory_t = IMAGE_DATA_DIRECTORY;
using ExportDirectory_t = IMAGE_EXPORT_DIRECTORY;
using RelocationBase_t = IMAGE_BASE_RELOCATION;
using ImportAddressTable_t = std::uint32_t;
};
template<> struct Image_t<64>
{
using Header_t = IMAGE_NT_HEADERS64;
using TLSDirectory_t = IMAGE_TLS_DIRECTORY64;
using ThunkData_t = IMAGE_THUNK_DATA64;
using Address_t = std::uint64_t;
using OptionalHeader_t = IMAGE_OPTIONAL_HEADER64;
};
template<> struct Image_t<32>
{
using Header_t = IMAGE_NT_HEADERS32;
using TLSDirectory_t = IMAGE_TLS_DIRECTORY32;
using ThunkData_t = IMAGE_THUNK_DATA32;
using Address_t = std::uint32_t;
using OptionalHeader_t = IMAGE_OPTIONAL_HEADER32;
};
}
///
//! class Image
//! Used for runtime or static analysis/manipulating of PE files.
///
template<unsigned int bitsize = 32>
class Image : pepp::msc::NonCopyable
{
using CPEHeader = const PEHeader<bitsize>;
using CExportDirectory = const ExportDirectory;
using CImportDirectory = const ImportDirectory;
public:
//! Publicize the detail::Image_t used by this image.
using ImageData_t = detail::Image_t<bitsize>;
friend class PEHeader<bitsize>;
static_assert(bitsize == 32 || bitsize == 64, "Invalid bitsize fed into PE::Image");
private:
detail::Image_t<>::MZHeader_t* m_MZHeader;
std::string m_fileName{};
mem::ByteVector m_imageBuffer{};
PEHeader<bitsize> m_PEHeader;
//! Sections
SectionHeader* m_rawSectionHeaders;
//! Exports
ExportDirectory<bitsize> m_exportDirectory;
//! Imports
ImportDirectory<bitsize> m_importDirectory;
//! Relocations
RelocationDirectory<bitsize> m_relocDirectory;
//! Is image mapped? Rva2Offset becomes obsolete
bool m_mem_mapped = false;
public:
//! Default ctor.
Image();
//! Used to construct a `class Image` via a existing file
Image(std::string_view filepath);
//! Used to construct a `class Image` via a memory buffer
Image(const void* data, std::size_t size);
//! Used to construct via another `class Image`
Image(const Image& image);
//!
[[nodiscard]] static Image FromRuntimeMemory(void* data, std::size_t size) noexcept;
//!
bool SetFromRuntimeMemory(void* data, std::size_t size) noexcept;
//! Get the start pointer of the buffer.
std::uint8_t* base() {
return m_imageBuffer.data();
}
mem::ByteVector& buffer() {
return m_imageBuffer;
}
const mem::ByteVector& buffer() const {
return m_imageBuffer;
}
//! Magic number in the DOS header.
std::uint16_t magic() const {
return m_MZHeader->e_magic;
}
//! PEHeader wrapper
class PEHeader<bitsize>& GetPEHeader() {
return m_PEHeader;
}
class ExportDirectory<bitsize>& GetExportDirectory() {
return m_exportDirectory;
}
class ImportDirectory<bitsize>& GetImportDirectory() {
return m_importDirectory;
}
class RelocationDirectory<bitsize>& GetRelocationDirectory() {
return m_relocDirectory;
}
const PEHeader<bitsize>& GetPEHeader() const {
return m_PEHeader;
}
const class ExportDirectory<bitsize>& GetExportDirectory() const {
return m_exportDirectory;
}
const class ImportDirectory<bitsize>& GetImportDirectory() const {
return m_importDirectory;
}
const class RelocationDirectory<bitsize>& GetRelocationDirectory() const {
return m_relocDirectory;
}
//! Native pointer
detail::Image_t<>::MZHeader_t* native() {
return m_MZHeader;
}
//! Write out changes to a new functional image.
[[nodiscard]] Image<bitsize> Compile();
//!
void SetMapped() noexcept;
//! Get PEMachine
constexpr PEMachine GetMachine() const;
//! Is X64
static constexpr unsigned int GetBitSize() { return bitsize; }
//! Add a new section to the image
bool AppendSection(std::string_view sectionName, std::uint32_t size, std::uint32_t chars, SectionHeader* out = nullptr);
//! Extend an existing section (will break things depending on the section)
bool ExtendSection(std::string_view sectionName, std::uint32_t delta);
//! Append a new export
bool AppendExport(std::string_view exportName, std::uint32_t rva);
//! Find offset padding of value v with count n, starting at specified header or bottom of image if none specified
std::uint32_t FindPadding(SectionHeader* s, std::uint8_t v, std::size_t n, std::uint32_t alignment = 0);
//! Find offset zero padding up to N bytes, starting at specified header or bottom of image if none specified
std::uint32_t FindZeroPadding(SectionHeader* s, std::size_t n, std::uint32_t alignment = 0);
//! Find (wildcard acceptable) binary sequence
std::vector<std::uint32_t> FindBinarySequence(SectionHeader* s, std::string_view binary_seq) const;
std::vector<std::pair<std::int32_t, std::uint32_t>> FindBinarySequences(SectionHeader* s, std::initializer_list<std::pair<std::int32_t, std::string_view>> binary_seq) const;
//! Check if a data directory is "present"
//! - Necessary before actually using the directory
//! (e.g not all images will have a valid IMAGE_EXPORT_DIRECTORY)
bool HasDataDirectory(PEDirectoryEntry entry);
//! Write out to file
void WriteToFile(std::string_view filepath);
//! Wrappers
SectionHeader& GetSectionHeader(std::uint16_t dwIndex) {
return m_PEHeader.GetSectionHeader(dwIndex);
}
SectionHeader& GetSectionHeader(std::string_view name) {
return m_PEHeader.GetSectionHeader(name);
}
SectionHeader& GetSectionHeaderFromVa(std::uint32_t va) {
return m_PEHeader.GetSectionHeaderFromVa(va);
}
SectionHeader& GetSectionHeaderFromOffset(std::uint32_t offset) {
return m_PEHeader.GetSectionHeaderFromOffset(offset);
}
std::uint16_t GetNumberOfSections() const {
return m_PEHeader.GetFileHeader().GetNumberOfSections();
}
constexpr auto GetWordSize() const {
return bitsize == 64 ? sizeof(std::uint64_t) : sizeof(std::uint32_t);
}
private:
//! Setup internal objects/pointers and validate they are proper.
void _validate();
};
using Image64 = Image<64>;
using Image86 = Image<32>;
}
================================================
FILE: vendor/pepp/ImportDirectory.cpp
================================================
#include "PELibrary.hpp"
using namespace pepp;
// Explicit templates.
template class ImportDirectory<32>;
template class ImportDirectory<64>;
template<unsigned int bitsize>
bool ImportDirectory<bitsize>::ImportsModule(std::string_view module, std::uint32_t* name_rva) const
{
auto descriptor = m_base;
mem::ByteVector const* buffer = &m_image->buffer();
while (descriptor->FirstThunk != 0) {
std::uint32_t offset = m_image->GetPEHeader().RvaToOffset(descriptor->Name);
std::string_view modname = buffer->as<const char*>(offset);
if (_stricmp(modname.data(), module.data()) == 0)
{
if (name_rva)
*name_rva = descriptor->Name;
return true;
}
descriptor++;
}
if (name_rva)
*name_rva = 0;
return false;
}
template<unsigned int bitsize>
bool ImportDirectory<bitsize>::HasModuleImport(std::string_view module, std::string_view import, std::uint32_t* rva) const
{
auto descriptor = m_base;
mem::ByteVector const* buffer = &m_image->buffer();
while (descriptor->Characteristics != 0) {
std::uint32_t offset = m_image->GetPEHeader().RvaToOffset(descriptor->Name);
if (_stricmp(buffer->as<const char*>(offset), module.data()) == 0)
{
std::int32_t index = 0;
typename detail::Image_t<bitsize>::ThunkData_t* firstThunk =
buffer->as<decltype(firstThunk)>(m_image->GetPEHeader().RvaToOffset(descriptor->OriginalFirstThunk));
while (firstThunk->u1.AddressOfData)
{
//
// TODO: Ordinals not handled here.
if (IsImportOrdinal(firstThunk->u1.Ordinal))
{
index++;
firstThunk++;
continue;
}
IMAGE_IMPORT_BY_NAME* _imp =
buffer->as<decltype(_imp)>(m_image->GetPEHeader().RvaToOffset(firstThunk->u1.AddressOfData));
if (import == _imp->Name)
{
if (rva)
*rva = descriptor->FirstThunk + (index * m_image->GetWordSize());
return true;
}
index++;
firstThunk++;
}
}
descriptor++;
}
if (rva)
*rva = 0;
return false;
}
template<unsigned int bitsize>
void ImportDirectory<bitsize>::AddModuleImport(std::string_view module, std::string_view import, std::uint32_t* rva)
{
// TODO: Clean this up and optimize some things.
auto descriptor = m_base;
mem::ByteVector* buffer = &m_image->buffer();
std::unique_ptr<std::uint8_t> descriptors;
std::uint32_t vsize = 0, rawsize = 0;
vsize = m_image->GetPEHeader()
.GetOptionalHeader()
.GetDataDirectory(DIRECTORY_ENTRY_IMPORT).Size;
descriptors.reset(new uint8_t[vsize]);
memset(descriptors.get(), 0, vsize);
SectionHeader newSec;
//
// Add in all the descriptors, so we can relocate them.
while (descriptor->Characteristics != 0)
{
std::memcpy(&descriptors.get()[rawsize], descriptor, sizeof(*descriptor));
rawsize += sizeof detail::Image_t<>::ImportDescriptor_t;
std::memset(descriptor, 0x0, sizeof(*descriptor));
descriptor++;
}
//
// For the null term.
rawsize += sizeof detail::Image_t<>::ImportDescriptor_t;
//
// Create a new section for the descriptors
if (newSec = m_image->GetSectionHeader(".pepp"); newSec.GetName() == ".dummy")
{
//
// We split a new section into two portions
// The first part contains IAT addresses, or IMAGE_IMPORT_BY_NAME structs.
// The second part contains import descriptors
// NOTE: The section size may need to be modified depending on how many imports need to be added
// This is using quite a large section due to a IAT rebuilding tool I created previously.
m_image->AppendSection(
".pepp",
20 * PAGE_SIZE,
SCN_MEM_READ |
SCN_MEM_WRITE |
SCN_CNT_INITIALIZED_DATA |
SCN_MEM_EXECUTE, &newSec);
memset(buffer->as<void*>(newSec.GetPointerToRawData()), 0xcc, newSec.GetSizeOfRawData());
newSec.SetPointerToRelocations(0);
newSec.SetPointerToLinenumbers(0);
newSec.SetNumberOfRelocations(0);
newSec.SetNumberOfLinenumbers(0);
// Ghetto, needed for now.
memcpy(&m_image->GetSectionHeader(".pepp"), &newSec, sizeof newSec);
//
// Set the new base.
m_base = reinterpret_cast<decltype(m_base)>(
&m_image->base()[m_image->GetPEHeader().RvaToOffset(
newSec.GetVirtualAddress() + (10*PAGE_SIZE))]);
}
//
// Fill in the original descriptors
std::memcpy(&buffer->at(newSec.GetPointerToRawData() + (10*PAGE_SIZE)), descriptors.get(), vsize);
//
// Set the new directory
m_image->GetPEHeader()
.GetOptionalHeader()
.GetDataDirectory(DIRECTORY_ENTRY_IMPORT).VirtualAddress
= newSec.GetVirtualAddress() + (10*PAGE_SIZE);
m_image->GetPEHeader()
.GetOptionalHeader()
.GetDataDirectory(DIRECTORY_ENTRY_IMPORT).Size
= vsize + sizeof detail::Image_t<>::ImportDescriptor_t;
std::uint32_t descriptor_offset = newSec.GetPointerToRawData() + (10*PAGE_SIZE) + vsize - sizeof(*descriptor);
descriptor = (decltype(descriptor)) & ((*buffer)[descriptor_offset]);
//
// Fill in default values, we don't use these
descriptor->ForwarderChain = 0;
descriptor->TimeDateStamp = 0;
//
// 1) Check if requested module already exists as string, and use that RVA
std::uint32_t name_rva = 0;
std::uint32_t tmp_offset = 0;
std::uint32_t iat_rva = 0;
std::uint32_t tmp_rva = 0;
std::uint32_t oft_offset = 0;
std::uint32_t oft_rva = 0;
if (!ImportsModule(module, &name_rva))
{
// 2) If 1 isn't possible, add a section or extend the data section (hard)
// and add in the module name manually
// - set descriptor->Name to that rva
tmp_offset = m_image->FindPadding(&newSec, 0xcc, module.size() + 1);
name_rva = m_image->GetPEHeader().OffsetToRva(tmp_offset);
std::memcpy(buffer->as<char*>(tmp_offset), module.data(), module.size());
buffer->as<char*>(tmp_offset)[module.size()] = 0;
}
descriptor->Name = name_rva;
using ImageThunkData_t = typename detail::Image_t<bitsize>::ThunkData_t;
ImageThunkData_t thunks[2];
// 3) Add in FirstThunk
tmp_offset = m_image->FindPadding(&newSec, 0xcc, sizeof(thunks), m_image->GetWordSize());
iat_rva = m_image->GetPEHeader().OffsetToRva(tmp_offset);
//
// Fill in values so that it doesn't get taken up next time this function is called
// Also, these need to be zero.
memset(buffer->as<void*>(tmp_offset), 0x00, sizeof(thunks));
ImageThunkData_t* firstThunk = m_image->buffer().as<ImageThunkData_t*>(tmp_offset);
firstThunk->u1.AddressOfData = iat_rva;
descriptor->FirstThunk = iat_rva;
if (rva)
*rva = iat_rva;
// 4) Add in OriginalFirstThunk
tmp_offset = m_image->FindPadding(&newSec, 0xcc, sizeof(thunks), m_image->GetWordSize());
tmp_rva = m_image->GetPEHeader().OffsetToRva(tmp_offset);
//
// Fill in values so that it doesn't get taken up next time this function is called
// Also, these need to be zero.
memset(buffer->as<void*>(tmp_offset), 0x00, sizeof(thunks));
oft_offset = m_image->FindPadding(&newSec, 0xcc, sizeof(std::uint16_t) + import.size() + 1, m_image->GetWordSize());
oft_rva = m_image->GetPEHeader().OffsetToRva(oft_offset);
//
// Copy in name to the oft rva
IMAGE_IMPORT_BY_NAME* imp = buffer->as<IMAGE_IMPORT_BY_NAME*>(oft_offset);
imp->Hint = 0x0000;
memcpy(&imp->Name[0], import.data(), import.size());
imp->Name[import.size()] = 0;
ImageThunkData_t* ogFirstThunk = m_image->buffer().as<ImageThunkData_t*>(tmp_offset);
ogFirstThunk->u1.AddressOfData = oft_rva;
(ogFirstThunk + 1)->u1.AddressOfData = 0;
descriptor->OriginalFirstThunk = tmp_rva;
//
// Finally null terminate
memset((descriptor + 1), 0, sizeof(decltype(*descriptor)));
}
template<unsigned int bitsize>
void ImportDirectory<bitsize>::AddModuleImports(std::string_view module, std::initializer_list<std::string_view> imports, std::uint32_t* rva)
{
// TODO: Clean this up and optimize some things.
auto descriptor = m_base;
mem::ByteVector* buffer = &m_image->buffer();
std::unique_ptr<std::uint8_t> descriptors;
std::uint32_t vsize = 0, rawsize = 0;
vsize = m_image->GetPEHeader()
.GetOptionalHeader()
.GetDataDirectory(DIRECTORY_ENTRY_IMPORT).Size;
descriptors.reset(new uint8_t[vsize]);
memset(descriptors.get(), 0, vsize);
SectionHeader newSec;
//
// Add in all the descriptors, so we can relocate them.
while (descriptor->Characteristics != 0)
{
std::memcpy(&descriptors.get()[rawsize], descriptor, sizeof(*descriptor));
rawsize += sizeof detail::Image_t<>::ImportDescriptor_t;
std::memset(descriptor, 0x0, sizeof(*descriptor));
descriptor++;
}
//
// For the null term.
rawsize += sizeof detail::Image_t<>::ImportDescriptor_t;
//
// Create a new section for the descriptors
if (newSec = m_image->GetSectionHeader(".pepp"); newSec.GetName() == ".dummy")
{
//
// We split a new section into two portions
// The first part contains IAT addresses, or IMAGE_IMPORT_BY_NAME structs.
// The second part contains import descriptors
m_image->AppendSection(
".pepp",
2 * PAGE_SIZE,
SCN_MEM_READ |
SCN_MEM_WRITE |
SCN_CNT_INITIALIZED_DATA |
SCN_MEM_EXECUTE, &newSec);
memset(buffer->as<void*>(newSec.GetPointerToRawData()), 0xcc, newSec.GetSizeOfRawData());
newSec.SetPointerToRelocations(0);
newSec.SetPointerToLinenumbers(0);
newSec.SetNumberOfRelocations(0);
newSec.SetNumberOfLinenumbers(0);
// Ghetto, needed for now.
memcpy(&m_image->GetSectionHeader(".pepp"), &newSec, sizeof newSec);
//
// Set the new base.
m_base = reinterpret_cast<decltype(m_base)>(
&m_image->base()[m_image->GetPEHeader().RvaToOffset(
newSec.GetVirtualAddress() + PAGE_SIZE)]);
}
//
// Fill in the original descriptors
std::memcpy(&buffer->at(newSec.GetPointerToRawData() + PAGE_SIZE), descriptors.get(), vsize);
//
// Set the new directory
m_image->GetPEHeader()
.GetOptionalHeader()
.GetDataDirectory(DIRECTORY_ENTRY_IMPORT).VirtualAddress
= newSec.GetVirtualAddress() + PAGE_SIZE;
m_image->GetPEHeader()
.GetOptionalHeader()
.GetDataDirectory(DIRECTORY_ENTRY_IMPORT).Size
= vsize + sizeof detail::Image_t<>::ImportDescriptor_t;
std::uint32_t descriptor_offset = newSec.GetPointerToRawData() + PAGE_SIZE + vsize - sizeof(*descriptor);
descriptor = (decltype(descriptor)) & ((*buffer)[descriptor_offset]);
//
// Fill in default values, we don't use these
descriptor->ForwarderChain = 0;
descriptor->TimeDateStamp = 0;
//
// 1) Check if requested module already exists as string, and use that RVA
std::uint32_t name_rva = 0;
std::uint32_t tmp_offset = 0;
std::uint32_t iat_rva = 0;
std::uint32_t tmp_rva = 0;
std::uint32_t oft_offset = 0;
std::uint32_t oft_rva = 0;
if (!ImportsModule(module, &name_rva))
{
// 2) If 1 isn't possible, add a section or extend the data section (hard)
// and add in the module name manually
// - set descriptor->Name to that rva
tmp_offset = m_image->FindPadding(&newSec, 0xcc, module.size() + 1);
name_rva = m_image->GetPEHeader().OffsetToRva(tmp_offset);
std::memcpy(buffer->as<char*>(tmp_offset), module.data(), module.size());
buffer->as<char*>(tmp_offset)[module.size()] = 0;
}
descriptor->Name = name_rva;
using ImageThunkData_t = typename detail::Image_t<bitsize>::ThunkData_t;
std::size_t thunksize = (imports.size() + 1) * sizeof(ImageThunkData_t);
// 3) Add in FirstThunk
tmp_offset = m_image->FindPadding(&newSec, 0xcc, thunksize, m_image->GetWordSize());
iat_rva = m_image->GetPEHeader().OffsetToRva(tmp_offset);
//
// Fill in values so that it doesn't get taken up next time this function is called
// Also, these need to be zero.
memset(buffer->as<void*>(tmp_offset), 0x00, thunksize);
ImageThunkData_t* firstThunk = m_image->buffer().as<ImageThunkData_t*>(tmp_offset);
firstThunk->u1.AddressOfData = iat_rva;
descriptor->FirstThunk = iat_rva;
// 4) Add in OriginalFirstThunk
tmp_offset = m_image->FindPadding(&newSec, 0xcc, thunksize, m_image->GetWordSize());
tmp_rva = m_image->GetPEHeader().OffsetToRva(tmp_offset);
//
// Fill in values so that it doesn't get taken up next time this function is called
// Also, these need to be zero.
memset(buffer->as<void*>(tmp_offset), 0x00, thunksize);
ImageThunkData_t* ogFirstThunk = m_image->buffer().as<ImageThunkData_t*>(tmp_offset);
int i = 0;
for (auto it = imports.begin(); it != imports.end(); it++)
{
oft_offset = m_image->FindPadding(&newSec, 0xcc, sizeof(std::uint16_t) + it->size() + 1, m_image->GetWordSize());
oft_rva = m_image->GetPEHeader().OffsetToRva(oft_offset);
//
// Copy in name to the oft rva
IMAGE_IMPORT_BY_NAME* imp = buffer->as<IMAGE_IMPORT_BY_NAME*>(oft_offset);
imp->Hint = 0x0000;
memcpy(&imp->Name[0], it->data(), it->size());
imp->Name[it->size()] = '\0';
if (rva)
rva[i] = iat_rva + (m_image->GetWordSize() * i++);
ogFirstThunk->u1.AddressOfData = oft_rva;
ogFirstThunk++;
}
ogFirstThunk->u1.AddressOfData = 0;
descriptor->OriginalFirstThunk = tmp_rva;
//
// Finally null terminate
memset((descriptor + 1), 0, sizeof(decltype(*descriptor)));
}
template<unsigned int bitsize>
void ImportDirectory<bitsize>::TraverseImports(const std::function<void(ModuleImportData_t*)>& cb_func)
{
auto descriptor = m_base;
mem::ByteVector const* buffer = &m_image->buffer();
while (descriptor->Characteristics != 0) {
std::uint32_t offset = m_image->GetPEHeader().RvaToOffset(descriptor->Name);
const char* module = buffer->as<const char*>(offset);
std::int32_t index = 0;
typename detail::Image_t<bitsize>::ThunkData_t* firstThunk =
buffer->as<decltype(firstThunk)>(m_image->GetPEHeader().RvaToOffset(descriptor->OriginalFirstThunk));
ModuleImportData_t data{};
data.module_name_rva = descriptor->Name;
data.module_name = module;
data.import_rva = -1;
while (firstThunk->u1.AddressOfData)
{
IMAGE_IMPORT_BY_NAME* _imp =
buffer->as<decltype(_imp)>(m_image->GetPEHeader().RvaToOffset(firstThunk->u1.AddressOfData));
if (IsImportOrdinal(firstThunk->u1.Ordinal))
{
data.ordinal = true;
data.import_variant = (std::uint64_t)firstThunk->u1.Ordinal;
data.import_name_rva = 0;
}
else
{
data.import_variant = static_cast<char*>(_imp->Name);
data.import_name_rva = firstThunk->u1.AddressOfData + sizeof(std::uint16_t);
}
data.import_rva = descriptor->FirstThunk + (index * m_image->GetWordSize());
//
// Call the callback
cb_func(&data);
index++;
firstThunk++;
}
descriptor++;
}
}
template<unsigned int bitsize>
void ImportDirectory<bitsize>::GetIATOffsets(std::uint32_t& begin, std::uint32_t& end) noexcept
{
//
// Null out.
begin = end = 0;
IMAGE_DATA_DIRECTORY const& iat = m_image->GetPEHeader().GetOptionalHeader().GetDataDirectory(IMAGE_DIRECTORY_ENTRY_IAT);
if (iat.Size == 0)
return;
begin = m_image->GetPEHeader().RvaToOffset(iat.VirtualAddress);
end = begin + iat.Size;
}
================================================
FILE: vendor/pepp/ImportDirectory.hpp
================================================
#pragma once
#include <string_view>
#include <functional>
#include <variant>
namespace pepp
{
struct ModuleImportData_t
{
std::uint32_t module_name_rva;
std::string module_name;
std::uint32_t import_name_rva;
std::variant<std::string, std::uint64_t> import_variant;
std::uint32_t import_rva;
bool ordinal;
};
static constexpr auto IMPORT_ORDINAL_FLAG_32 = IMAGE_ORDINAL_FLAG32;
static constexpr auto IMPORT_ORDINAL_FLAG_64 = IMAGE_ORDINAL_FLAG64;
template<unsigned int bitsize>
class ImportDirectory : pepp::msc::NonCopyable
{
friend class Image<32>;
friend class Image<64>;
Image<bitsize>* m_image;
detail::Image_t<>::ImportDescriptor_t* m_base;
detail::Image_t<>::ImportAddressTable_t m_iat_base;
public:
ImportDirectory() = default;
bool ImportsModule(std::string_view module, std::uint32_t* name_rva = nullptr) const;
bool HasModuleImport(std::string_view module, std::string_view import, std::uint32_t* rva = nullptr) const;
void AddModuleImport(std::string_view module, std::string_view import, std::uint32_t* rva = nullptr);
void AddModuleImports(std::string_view module, std::initializer_list<std::string_view> imports, std::uint32_t* rva = nullptr);
void TraverseImports(const std::function<void(ModuleImportData_t*)>& cb_func);
void SetCharacteristics(std::uint32_t chrs) {
m_base->Characteristics = chrs;
}
std::uint32_t GetCharacteristics() const {
return m_base->Characteristics;
}
void SetTimeDateStamp(std::uint32_t TimeDateStamp) {
m_base->TimeDateStamp = TimeDateStamp;
}
std::uint32_t GetTimeDateStamp() const {
return m_base->TimeDateStamp;
}
//! Util
template<typename T>
bool IsImportOrdinal(T ord) const requires pepp::msc::MemoryAddress<T> {
if constexpr (bitsize == 64)
return (ord & IMPORT_ORDINAL_FLAG_64) != 0;
return (ord & IMPORT_ORDINAL_FLAG_32) != 0;
}
void GetIATOffsets(std::uint32_t& begin, std::uint32_t& end) noexcept;
private:
//! Setup the directory
void _setup(Image<bitsize>* image) {
m_image = image;
m_base = reinterpret_cast<decltype(m_base)>(
&image->base()[image->GetPEHeader().RvaToOffset(
image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_IMPORT).VirtualAddress)]);
m_iat_base = reinterpret_cast<decltype(m_iat_base)>(
&image->base()[image->GetPEHeader().RvaToOffset(
image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_IAT).VirtualAddress)]);
}
};
}
================================================
FILE: vendor/pepp/OptionalHeader.cpp
================================================
#include "PELibrary.hpp"
using namespace pepp;
// Explicit templates.
template class OptionalHeader<32>;
template class OptionalHeader<64>;
template<unsigned int bitsize>
inline OptionalHeader<bitsize>::OptionalHeader()
{
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetMagic(PEMagic magic)
{
m_base->Magic = static_cast<std::uint16_t>(magic);
}
template<unsigned int bitsize>
PEMagic OptionalHeader<bitsize>::GetMagic() const
{
return static_cast<PEMagic>(m_base->Magic);
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetImageBase(detail::Image_t<bitsize>::Address_t address)
{
m_base->ImageBase = address;
}
template<unsigned int bitsize>
detail::Image_t<bitsize>::Address_t OptionalHeader<bitsize>::GetImageBase() const
{
return m_base->ImageBase;
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetSizeOfImage(std::uint32_t size)
{
m_base->SizeOfImage = size;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetSizeOfImage() const
{
return m_base->SizeOfImage;
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetSizeOfCode(std::uint32_t dwSize)
{
m_base->SizeOfCode = dwSize;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetSizeOfCode() const
{
return m_base->SizeOfCode;
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetSizeOfInitializedData(std::uint32_t dwSize)
{
m_base->SizeOfInitializedData = dwSize;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetSizeOfInitializedData() const
{
return m_base->SizeOfInitializedData;
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetSizeOfUninitializedData(std::uint32_t dwSize)
{
m_base->SizeOfUninitializedData = dwSize;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetSizeOfUninitializedData() const
{
return m_base->SizeOfUninitializedData;
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetBaseOfCode(std::uint32_t dwBase)
{
m_base->BaseOfCode = dwBase;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetBaseOfCode() const
{
return m_base->BaseOfCode;
}
template<unsigned int bitsize>
void OptionalHeader<bitsize>::SetAddressOfEntryPoint(std::uint32_t dwBase)
{
m_base->AddressOfEntryPoint = dwBase;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetAddressOfEntryPoint() const
{
return m_base->AddressOfEntryPoint;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetFileAlignment() const
{
return m_base->FileAlignment;
}
template<unsigned int bitsize>
std::uint32_t OptionalHeader<bitsize>::GetSectionAlignment() const
{
return m_base->SectionAlignment;
}
template<unsigned int bitsize>
bool OptionalHeader<bitsize>::HasRelocations() const
{
return m_base->DataDirectory[DIRECTORY_ENTRY_BASERELOC].Size > 0;
}
================================================
FILE: vendor/pepp/OptionalHeader.hpp
================================================
#pragma once
namespace pepp
{
enum PEDirectoryEntry
{
DIRECTORY_ENTRY_EXPORT = 0, // Export Directory
DIRECTORY_ENTRY_IMPORT = 1, // Import Directory
DIRECTORY_ENTRY_RESOURCE = 2, // Resource Directory
DIRECTORY_ENTRY_EXCEPTION = 3, // Exception Directory
DIRECTORY_ENTRY_SECURITY = 4, // Security Directory
DIRECTORY_ENTRY_BASERELOC = 5, // Base Relocation Table
DIRECTORY_ENTRY_DEBUG = 6, // Debug Directory
DIRECTORY_ENTRY_ARCHITECTURE = 7, // Architecture Specific Data
DIRECTORY_ENTRY_GLOBALPTR = 8, // RVA of GP
DIRECTORY_ENTRY_TLS = 9, // TLS Directory
DIRECTORY_ENTRY_LOAD_CONFIG = 10, // Load Configuration Directory
DIRECTORY_ENTRY_BOUND_IMPORT = 11, // Bound Import Directory in headers
DIRECTORY_ENTRY_IAT = 12, // Import Address Table
DIRECTORY_ENTRY_DELAY_IMPORT = 13, // Delay Load Import Descriptors
DIRECTORY_ENTRY_COM_DESCRIPTOR = 14 // COM Runtime descriptor
};
enum class PEMagic
{
HDR_32 = 0x10b,
HDR_64 = 0x20b,
HDR_ROM = 0x107
};
template<unsigned int bitsize = 32>
class OptionalHeader : pepp::msc::NonCopyable
{
friend class PEHeader<bitsize>;
friend class Image<bitsize>;
using ImageData_t = detail::Image_t<bitsize>;
Image<bitsize>* m_Image;
ImageData_t::OptionalHeader_t* m_base{ nullptr };
public:
OptionalHeader();
//! Getter/setter for OptionalHeader.Magic
void SetMagic(PEMagic magic);
PEMagic GetMagic() const;
//! Getter/setter for OptionalHeader.ImageBase
void SetImageBase(detail::Image_t<bitsize>::Address_t address);
detail::Image_t<bitsize>::Address_t GetImageBase() const;
//! Getter/setter for OptionalHeader.SizeOfImage
void SetSizeOfImage(std::uint32_t size);
std::uint32_t GetSizeOfImage() const;
//! Getter/setter for OptionalHeader.SizeOfCode
void SetSizeOfCode(std::uint32_t dwSize);
std::uint32_t GetSizeOfCode() const;
//! Getter/setter for OptionalHeader.SizeOfInitializedData
void SetSizeOfInitializedData(std::uint32_t dwSize);
std::uint32_t GetSizeOfInitializedData() const;
//! Getter/setter for OptionalHeader.SizeOfUninitializedData
void SetSizeOfUninitializedData(std::uint32_t dwSize);
std::uint32_t GetSizeOfUninitializedData() const;
//! Getter/setter for OptionalHeader.BaseOfCode
void SetBaseOfCode(std::uint32_t dwBase);
std::uint32_t GetBaseOfCode() const;
//! Getter/setter for OptionalHeader.AddressOfEntryPoint
void SetAddressOfEntryPoint(std::uint32_t dwBase);
std::uint32_t GetAddressOfEntryPoint() const;
//! Getter for OptionalHeader.FileAlignment
std::uint32_t GetFileAlignment() const;
//! Getter for OptionalHeader.SectionAlignment
std::uint32_t GetSectionAlignment() const;
//! Get data directory
detail::Image_t<>::DataDirectory_t& GetDataDirectory(int idx) const {
return m_base->DataDirectory[idx];
}
//! Calculate the number of directories present (not NumberOfRvaAndSizes)
std::uint32_t DirectoryCount() const {
std::uint32_t count{ 0ul };
for (int i = 0; i < MAX_DIRECTORY_COUNT; i++)
{
if (GetDataDirectory(i).Size > 0) {
++count;
}
}
return count;
}
std::uint8_t* base() const {
return (std::uint8_t*)m_base;
}
//! Check if image has relocations
bool HasRelocations() const;
private:
void _setup(Image<bitsize>* image) {
m_Image = image;
m_base = &image->GetPEHeader().native()->OptionalHeader;
}
};
}
================================================
FILE: vendor/pepp/PEHeader.cpp
================================================
#include "PELibrary.hpp"
using namespace pepp;
// Explicit templates.
template class PEHeader<32>;
template class PEHeader<64>;
template<unsigned int bitsize>
inline PEHeader<bitsize>::PEHeader()
: m_Image(nullptr)
{
}
template<unsigned int bitsize>
std::uint32_t PEHeader<bitsize>::GetSizeOfImage()
{
std::uint32_t dwLowestRva{ 0 };
std::uint32_t dwHighestRva{ 0 };
for (std::uint16_t n = 0; n < GetFileHeader().GetNumberOfSections(); n++) {
//
// Skip sections with bad Misc.VirtualSize
if (m_Image->m_rawSectionHeaders[n].GetVirtualSize() == 0)
continue;
//
// Fill in high/low rvas if possible.
if (m_Image->m_rawSectionHeaders[n].GetVirtualAddress() < dwLowestRva)
dwLowestRva =
m_Image->m_rawSectionHeaders[n].GetVirtualAddress();
if (m_Image->m_rawSectionHeaders[n].GetVirtualAddress() > dwHighestRva)
dwHighestRva =
m_Image->m_rawSectionHeaders[n].GetVirtualAddress() + m_Image->m_rawSectionHeaders[n].GetVirtualSize();
}
return (dwHighestRva - dwLowestRva);
}
template<unsigned int bitsize>
std::uint32_t PEHeader<bitsize>::GetStartOfCode()
{
return m_OptionalHeader.GetBaseOfCode();
}
template<unsigned int bitsize>
std::uint32_t PEHeader<bitsize>::GetNextSectionOffset()
{
std::uint16_t nlastSecIdx = GetFileHeader().GetNumberOfSections() - 1;
SectionHeader const& sec = GetSectionHeader(nlastSecIdx);
std::uint32_t uNextOffset = sec.GetPointerToRawData() + sec.GetSizeOfRawData();
/*
* FileAlignment
* The alignment of the raw data of sections in the image file, in bytes.
*/
return Align(uNextOffset, GetOptionalHeader().GetFileAlignment());
}
template<unsigned int bitsize>
std::uint32_t PEHeader<bitsize>::GetNextSectionRva()
{
std::uint16_t nlastSecIdx = GetFileHeader().GetNumberOfSections() - 1;
SectionHeader const& sec = GetSectionHeader(nlastSecIdx);
std::uint32_t uNextRva = sec.GetVirtualAddress() + sec.GetVirtualSize();
/*
* SectionAlignment
* The alignment of sections loaded in memory, in bytes.
*/
return Align(uNextRva, GetOptionalHeader().GetSectionAlignment());
}
================================================
FILE: vendor/pepp/PEHeader.hpp
================================================
#pragma once
namespace pepp
{
constexpr static int MAX_DIRECTORY_COUNT = 16;
template<unsigned int>
class Image;
template<unsigned int>
class OptionalHeader;
class SectionHeader;
class FileHeader;
template<unsigned int bitsize = 32>
class PEHeader : pepp::msc::NonCopyable
{
friend class Image<bitsize>;
using ImageData_t = detail::Image_t<bitsize>;
Image<bitsize>* m_Image;
ImageData_t::Header_t* m_PEHdr = nullptr;
FileHeader m_FileHeader;
OptionalHeader<bitsize> m_OptionalHeader;
private:
//! Private constructor, this should never be established outside of `class Image`
PEHeader();
public:
class FileHeader& GetFileHeader() {
return m_FileHeader;
}
const class FileHeader& GetFileHeader() const {
return m_FileHeader;
}
class OptionalHeader<bitsize>& GetOptionalHeader() {
return m_OptionalHeader;
}
const class OptionalHeader<bitsize>& GetOptionalHeader() const {
return m_OptionalHeader;
}
SectionHeader& GetSectionHeader(std::uint16_t dwIndex) {
static SectionHeader dummy{};
if (dwIndex < m_Image->GetNumberOfSections())
return m_Image->m_rawSectionHeaders[dwIndex];
return dummy;
}
SectionHeader& GetSectionHeader(std::string_view name) {
static SectionHeader dummy{};
for (std::uint16_t n = 0; n < m_Image->GetNumberOfSections(); n++)
{
if (m_Image->m_rawSectionHeaders[n].GetName().compare(name) == 0) {
return m_Image->m_rawSectionHeaders[n];
}
}
return dummy;
}
SectionHeader& GetSectionHeaderFromVa(std::uint32_t va) {
static SectionHeader dummy{};
for (std::uint16_t n = 0; n < m_Image->GetNumberOfSections(); n++)
{
if (m_Image->m_rawSectionHeaders[n].HasVirtualAddress(va)) {
return m_Image->m_rawSectionHeaders[n];
}
}
return dummy;
}
SectionHeader& GetSectionHeaderFromOffset(std::uint32_t offset) {
static SectionHeader dummy{};
for (std::uint16_t n = 0; n < m_Image->GetNumberOfSections(); n++)
{
if (m_Image->m_rawSectionHeaders[n].HasOffset(offset)) {
return m_Image->m_rawSectionHeaders[n];
}
}
return dummy;
}
//! Calculate the number of directories present (not NumberOfRvaAndSizes)
std::uint32_t DirectoryCount() const {
return GetOptionalHeader().DirectoryCount();
}
//! Convert a relative virtual address to a file offset
std::uint32_t RvaToOffset(std::uint32_t rva) {
SectionHeader const& sec { GetSectionHeaderFromVa(rva) };
//
// Did we get one?
if (sec.GetName() != ".dummy") {
return sec.GetPointerToRawData() + rva - sec.GetVirtualAddress();
}
return 0ul;
}
//! Convert a file offset back to a relative virtual address
std::uint32_t OffsetToRva(std::uint32_t offset) {
SectionHeader const& sec{ GetSectionHeaderFromOffset(offset) };
//
// Did we get one?
if (sec.GetName() != ".dummy") {
return (sec.GetVirtualAddress() + offset) - sec.GetPointerToRawData();
}
return 0ul;
}
//! Convert a rel. virtual address to a virtual address
detail::Image_t<bitsize>::Address_t RvaToVa(std::uint32_t rva) const {
return m_OptionalHeader.GetImageBase() + rva;
}
//! Used to check if the NT tag is present.
bool IsTaggedPE() const {
return m_PEHdr->Signature == IMAGE_NT_SIGNATURE;
}
std::uint8_t* base() const {
return (std::uint8_t*)m_PEHdr;
}
constexpr std::size_t size() const {
return sizeof(decltype(*m_PEHdr));
}
//! Return native pointer
detail::Image_t<bitsize>::Header_t* native() {
return m_PEHdr;
}
//! Manually calculate the size of the image
std::uint32_t GetSizeOfImage();
//! Manually calculate the start of the code section
std::uint32_t GetStartOfCode();
//! Calculate next section offset
std::uint32_t GetNextSectionOffset();
//! Calculate next section rva
std::uint32_t GetNextSectionRva();
private:
//! Setup the header
void _setup(Image<bitsize>* image) {
m_Image = image;
m_PEHdr = reinterpret_cast<decltype(m_PEHdr)>(m_Image->base() + m_Image->m_MZHeader->e_lfanew);
m_FileHeader._setup(image);
m_OptionalHeader._setup(image);
}
};
}
================================================
FILE: vendor/pepp/PELibrary.hpp
================================================
#pragma once
#include <Windows.h>
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <cassert>
#include "misc/File.hpp"
#include "misc/NonCopyable.hpp"
#include "misc/ByteVector.hpp"
#include "misc/Concept.hpp"
#include "misc/Address.hpp"
#include "Image.hpp"
#include "PEHeader.hpp"
#include "SectionHeader.hpp"
#include "FileHeader.hpp"
#include "OptionalHeader.hpp"
#include "ExportDirectory.hpp"
#include "ImportDirectory.hpp"
#include "RelocationDirectory.hpp"
#include "PEUtil.hpp"
================================================
FILE: vendor/pepp/PEUtil.cpp
================================================
#include "PELibrary.hpp"
#include <DbgHelp.h>
#pragma comment(lib, "dbghelp.lib")
using namespace pepp;
std::string pepp::DemangleName(std::string_view mangled_name)
{
//
// TODO: Don't rely on DbgHelp??
char undecorated_name[1024];
UnDecorateSymbolName(
mangled_name.data(),
undecorated_name,
sizeof undecorated_name,
UNDNAME_32_BIT_DECODE | UNDNAME_NAME_ONLY);
return undecorated_name;
}
================================================
FILE: vendor/pepp/PEUtil.hpp
================================================
#pragma once
namespace pepp
{
//! Windows 32/64bit declare the page size as 4kb (4096)
static constexpr std::uint32_t PAGE_SIZE = 0x1000;
//! Align a value
template<typename V_t>
constexpr __forceinline auto Align(V_t value, std::uint32_t alignment) requires std::unsigned_integral<V_t>
{
if (alignment == 0)
return value;
return ((value + alignment) & ~(alignment - 1));
}
//! Make a value 4kb aligned (for section purposes)
template<typename V_t>
constexpr __forceinline auto Align4kb(V_t v) requires std::unsigned_integral<V_t>
{
return Align(v, PAGE_SIZE);
}
//! Demangle a mangled name (MS supplied)
std::string DemangleName(std::string_view mangled_name);
}
================================================
FILE: vendor/pepp/RelocationDirectory.cpp
================================================
#include "PELibrary.hpp"
using namespace pepp;
// Explicit templates.
template class RelocationDirectory<32>;
template class RelocationDirectory<64>;
template<unsigned int bitsize>
int RelocationDirectory<bitsize>::GetNumberOfBlocks() const
{
auto base = m_base;
int count = 0;
while (base->VirtualAddress)
{
count++;
base = decltype(base)((char*)base + base->SizeOfBlock);
}
return count;
}
template<unsigned int bitsize>
int RelocationDirectory<bitsize>::GetNumberOfEntries(detail::Image_t<>::RelocationBase_t* reloc) const
{
// MSDN: The Block Size field is then followed by any number of Type or Offset field entries.
// Each entry is a WORD (2 bytes)
return (reloc->SizeOfBlock - sizeof(decltype(*reloc))) / sizeof(std::uint16_t);
}
template<unsigned int bitsize>
std::uint32_t RelocationDirectory<bitsize>::GetRemainingFreeBytes() const
{
auto base = m_base;
std::uint32_t count = 0;
while (base->VirtualAddress)
{
count += base->SizeOfBlock;
base = decltype(base)((char*)base + base->SizeOfBlock);
}
return std::max<std::uint32_t>(m_section->GetVirtualSize() - count, 0);
}
template<unsigned int bitsize>
bool pepp::RelocationDirectory<bitsize>::ChangeRelocationType(std::uint32_t rva, RelocationType type)
{
auto base = m_base;
std::vector<BlockEntry> entries;
while (base->VirtualAddress)
{
int numEntries = GetNumberOfEntries(base);
std::uint16_t* entry = (std::uint16_t*)(base + 1);
for (int i = 0; i != numEntries; i++, entry++)
{
BlockEntry block(base->VirtualAddress, *entry);
if (block.GetRva() == rva)
{
*entry = CraftRelocationBlockEntry(type, block.GetOffset());
return true;
}
}
base = decltype(base)((char*)base + base->SizeOfBlock);
}
return false;
}
template<unsigned int bitsize>
std::vector<BlockEntry> RelocationDirectory<bitsize>::GetBlockEntries(int blockIdx)
{
auto base = m_base;
int count = 0;
std::vector<BlockEntry> entries;
while (base->VirtualAddress)
{
if (count == blockIdx)
{
int numEntries = GetNumberOfEntries(base);
std::uint16_t* entry = (std::uint16_t*)(base + 1);
for (int i = 0; i != numEntries; i++, entry++)
{
entries.emplace_back(base->VirtualAddress, *entry);
}
}
base = decltype(base)((char*)base + base->SizeOfBlock);
count++;
}
return entries;
}
template<unsigned int bitsize>
BlockStream RelocationDirectory<bitsize>::CreateBlock(std::uint32_t rva, std::uint32_t num_entries)
{
std::uint32_t size = sizeof(detail::Image_t<>::RelocationBase_t) + num_entries * sizeof(std::uint16_t);
detail::Image_t<>::RelocationBase_t* reloc;
std::uint32_t remaining_bytes = GetRemainingFreeBytes();
if (remaining_bytes < size)
{
assert(m_image->ExtendSection(m_section->GetName(), size - remaining_bytes));
}
auto base = m_base;
int count = 0;
while (base->VirtualAddress)
{
base = decltype(base)((char*)base + base->SizeOfBlock);
}
base->VirtualAddress = rva;
base->SizeOfBlock = size;
return BlockStream(base);
}
================================================
FILE: vendor/pepp/RelocationDirectory.hpp
================================================
#pragma once
namespace pepp
{
/*
* Relocations: research32.blogspot.com/2015/01/base-relocation-table.html
* Format looks like
* 00 10 00 00 | RVA of Block
* 28 01 00 00 | Size of Block
* ?? ?? ?? ?? ..... | Entries in block
* (entry count = (reloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOC)) / sizeof(WORD))
*/
enum RelocationType : std::int8_t
{
REL_BASED_ABSOLUTE = 0,
REL_BASED_HIGH = 1,
REL_BASED_LOW = 2,
REL_BASED_HIGHLOW = 3,
REL_BASED_HIGHADJ = 4,
REL_BASED_MACHINE_SPECIFIC_5 = 5,
REL_BASED_RESERVED = 6,
REL_BASED_MACHINE_SPECIFIC_7 = 7,
REL_BASED_MACHINE_SPECIFIC_8 = 8,
REL_BASED_MACHINE_SPECIFIC_9 = 9,
REL_BASED_DIR64 = 10
};
constexpr std::uint16_t CraftRelocationBlockEntry(RelocationType type, std::uint16_t offset) noexcept {
return (offset & 0xfff) | (type << 12);
}
class BlockEntry
{
std::uint32_t m_va;
std::uint16_t m_entry;
public:
BlockEntry(std::uint32_t va, std::uint16_t entry)
: m_va(va)
, m_entry(entry)
{
}
RelocationType GetType() const
{
return static_cast<RelocationType>(m_entry >> 12);
}
std::uint32_t GetOffset() const
{
// Single out the last 12 bits of the entry
return static_cast<std::uint32_t>(m_entry & ((1 << 12) - 1));
}
std::uint32_t GetRva() const
{
return m_va + GetOffset();
}
constexpr operator std::uint16_t() const
{
return m_entry;
}
};
class BlockStream
{
std::uint16_t* m_base;
std::uint32_t m_idx;
std::uint32_t m_max_size;
public:
BlockStream(detail::Image_t<>::RelocationBase_t* reloc)
: m_base((std::uint16_t*)(reloc+1))
, m_idx(0)
, m_max_size(reloc->SizeOfBlock)
{
}
void Push(RelocationType type, std::uint16_t offset)
{
if (m_idx * sizeof(uint16_t) >= m_max_size)
return;
m_base[m_idx++] = CraftRelocationBlockEntry(type, offset);
}
};
template<unsigned int bitsize>
class RelocationDirectory : pepp::msc::NonCopyable
{
friend class Image<32>;
friend class Image<64>;
using PatchType_t = typename detail::Image_t<bitsize>::Address_t;
Image<bitsize>* m_image;
detail::Image_t<>::RelocationBase_t* m_base;
SectionHeader* m_section;
public:
int GetNumberOfBlocks() const;
int GetNumberOfEntries(detail::Image_t<>::RelocationBase_t* reloc) const;
std::uint32_t GetRemainingFreeBytes() const;
bool ChangeRelocationType(std::uint32_t rva, RelocationType type);
std::vector<BlockEntry> GetBlockEntries(int blockIdx);
BlockStream CreateBlock(std::uint32_t rva, std::uint32_t num_entries);
bool IsPresent() const {
return m_image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_BASERELOC).Size > 0;
}
private:
//! Setup the directory
void _setup(Image<bitsize>* image) {
m_image = image;
m_base = reinterpret_cast<decltype(m_base)>(
&image->base()[image->GetPEHeader().RvaToOffset(
image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_BASERELOC).VirtualAddress)]);
m_section =
&image->GetSectionHeaderFromVa(image->GetPEHeader().GetOptionalHeader().GetDataDirectory(DIRECTORY_ENTRY_BASERELOC).VirtualAddress);
}
};
}
================================================
FILE: vendor/pepp/SectionHeader.cpp
================================================
#include "PELibrary.hpp"
using namespace pepp;
void SectionHeader::SetName(std::string_view name)
{
std:memcpy(m_base.Name, name.data(), name.size());
}
std::string SectionHeader::GetName() const
{
char szData[9];
std::memcpy(szData, m_base.Name, sizeof m_base.Name);
szData[8] = '\0';
return szData;
}
std::uint32_t SectionHeader::GetFileAddress() const
{
return m_base.Misc.PhysicalAddress;
}
void SectionHeader::SetFileAddress(std::uint32_t fileAddress)
{
m_base.Misc.PhysicalAddress = fileAddress;
}
std::uint32_t SectionHeader::GetVirtualSize() const
{
return m_base.Misc.VirtualSize;
}
void SectionHeader::SetVirtualSize(std::uint32_t virtualSize)
{
m_base.Misc.VirtualSize = virtualSize;
}
std::uint32_t SectionHeader::GetVirtualAddress() const
{
return m_base.VirtualAddress;
}
void SectionHeader::SetVirtualAddress(std::uint32_t va)
{
m_base.VirtualAddress = va;
}
std::uint32_t SectionHeader::GetSizeOfRawData() const
{
return m_base.SizeOfRawData;
}
void SectionHeader::SetSizeOfRawData(std::uint32_t sz)
{
m_base.SizeOfRawData = sz;
}
std::uint32_t SectionHeader::GetPointerToRawData() const
{
return m_base.PointerToRawData;
}
void SectionHeader::SetPointerToRawData(std::uint32_t ptr)
{
m_base.PointerToRawData = ptr;
}
std::uint32_t SectionHeader::GetPointerToRelocations() const
{
return m_base.PointerToRelocations;
}
void SectionHeader::SetPointerToRelocations(std::uint32_t ptr)
{
m_base.PointerToRelocations = ptr;
}
std::uint32_t SectionHeader::GetPointerToLinenumbers() const
{
return m_base.PointerToLinenumbers;
}
void SectionHeader::SetPointerToLinenumbers(std::uint32_t ptr)
{
m_base.PointerToLinenumbers = ptr;
}
std::uint16_t SectionHeader::GetNumberOfRelocations() const
{
return m_base.NumberOfRelocations;
}
void SectionHeader::SetNumberOfRelocations(std::uint16_t num)
{
m_base.NumberOfRelocations = num;
}
std::uint16_t SectionHeader::GetNumberOfLinenumbers() const
{
return m_base.NumberOfLinenumbers;
}
void SectionHeader::SetNumberOfLinenumbers(std::uint16_t num)
{
m_base.NumberOfLinenumbers = num;
}
std::uint32_t SectionHeader::GetCharacteristics() const
{
return m_base.Characteristics;
}
void SectionHeader::SetCharacteristics(std::uint32_t chars)
{
m_base.Characteristics = chars;
}
================================================
FILE: vendor/pepp/SectionHeader.hpp
================================================
#pragma once
namespace pepp
{
template<unsigned int>
class Image;
enum SectionCharacteristics : std::uint32_t
{
SCN_TYPE_NO_PAD = 0x00000008, // Reserved.
SCN_CNT_CODE = 0x00000020, // Section contains code.
SCN_CNT_INITIALIZED_DATA = 0x00000040, // Section contains initialized data.
SCN_CNT_UNINITIALIZED_DATA = 0x00000080, // Section contains uninitialized data.
SCN_LNK_OTHER = 0x00000100, // Reserved.
SCN_LNK_INFO = 0x00000200, // Section contains comments or some other type of information.
SCN_LNK_REMOVE = 0x00000800, // Section contents will not become part of image.
SCN_LNK_COMDAT = 0x00001000, // Section contents comdat.
SCN_NO_DEFER_SPEC_EXC = 0x00004000, // Reset speculative exceptions handling bits in the TLB entries for this section.
SCN_GPREL = 0x00008000, // Section content can be accessed relative to GP
SCN_MEM_FARDATA = 0x00008000,
SCN_MEM_PURGEABLE = 0x00020000,
SCN_MEM_16BIT = 0x00020000,
SCN_MEM_LOCKED = 0x00040000,
SCN_MEM_PRELOAD = 0x00080000,
SCN_ALIGN_1BYTES = 0x00100000, //
SCN_ALIGN_2BYTES = 0x00200000, //
SCN_ALIGN_4BYTES = 0x00300000, //
SCN_ALIGN_8BYTES = 0x00400000, //
SCN_ALIGN_16BYTES = 0x00500000, // Default alignment if no others are specified.
SCN_ALIGN_32BYTES = 0x00600000, //
SCN_ALIGN_64BYTES = 0x00700000, //
SCN_ALIGN_128BYTES = 0x00800000, //
SCN_ALIGN_256BYTES = 0x00900000, //
SCN_ALIGN_512BYTES = 0x00A00000, //
SCN_ALIGN_1024BYTES = 0x00B00000, //
SCN_ALIGN_2048BYTES = 0x00C00000, //
SCN_ALIGN_4096BYTES = 0x00D00000, //
SCN_ALIGN_8192BYTES = 0x00E00000, //
SCN_ALIGN_MASK = 0x00F00000,
SCN_LNK_NRELOC_OVFL = 0x01000000, // Section contains extended relocations.
SCN_MEM_DISCARDABLE = 0x02000000, // Section can be discarded.
SCN_MEM_NOT_CACHED = 0x04000000, // Section is not cachable.
SCN_MEM_NOT_PAGED = 0x08000000, // Section is not pageable.
SCN_MEM_SHARED = 0x10000000, // Section is shareable.
SCN_MEM_EXECUTE = 0x20000000, // Section is executable.
SCN_MEM_READ = 0x40000000, // Section is readable.
SCN_MEM_WRITE = 0x80000000 // Section is writeable.
};
class SectionHeader
{
friend class Image<32>;
friend class Image<64>;
detail::Image_t<>::SectionHeader_t m_base;
public:
SectionHeader() {
memcpy(m_base.Name, ".dummy", sizeof(".dummy"));
}
//! Getter/setter for SectionHeader.Name
void SetName(std::string_view name);
std::string GetName() const;
//! Getter/setters for SectionHeader.Misc
std::uint32_t GetFileAddress() const;
void SetFileAddress(std::uint32_t fileAddress);
std::uint32_t GetVirtualSize() const;
void SetVirtualSize(std::uint32_t virtualSize);
//! Getter/setter for VirtualAddress
std::uint32_t GetVirtualAddress() const;
void SetVirtualAddress(std::uint32_t va);
//! Getter/setter for SizeOfRawData
std::uint32_t GetSizeOfRawData() const;
void SetSizeOfRawData(std::uint32_t sz);
//! Getter/setter for SizeOfRawData
std::uint32_t GetPointerToRawData() const;
void SetPointerToRawData(std::uint32_t ptr);
//! Getter/setter for PointerToRelocations
std::uint32_t GetPointerToRelocations() const;
void SetPointerToRelocations(std::uint32_t ptr);
//! Getter/setter for PointerToLinenumbers
std::uint32_t GetPointerToLinenumbers() const;
void SetPointerToLinenumbers(std::uint32_t ptr);
//! Getter/setter for NumberOfRelocations
std::uint16_t GetNumberOfRelocations() const;
void SetNumberOfRelocations(std::uint16_t num);
//! Getter/setter for
std::uint16_t GetNumberOfLinenumbers() const;
void SetNumberOfLinenumbers(std::uint16_t num);
//! Getter/setter for
std::uint32_t GetCharacteristics() const;
void SetCharacteristics(std::uint32_t chars);
// Section utility functions
void AddCharacteristic(std::uint32_t dwChar) {
m_base.Characteristics |= dwChar;
}
void StripCharacteristic(std::uint32_t dwChar) {
m_base.Characteristics &= ~dwChar;
}
bool IsReadable() const {
return GetCharacteristics() & SCN_MEM_READ;
}
bool IsWriteable() const {
return GetCharacteristics() & SCN_MEM_WRITE;
}
bool IsExecutable() const {
return GetCharacteristics() & SCN_MEM_EXECUTE;
}
bool HasVirtualAddress(std::uint32_t va) const {
return va >= m_base.VirtualAddress && va < m_base.VirtualAddress + m_base.Misc.VirtualSize;
}
bool HasOffset(std::uint32_t offset) const {
return offset >= m_base.PointerToRawData && offset < m_base.PointerToRawData + m_base.SizeOfRawData;
}
};
static_assert(sizeof(SectionHeader) == sizeof(detail::Image_t<>::SectionHeader_t), "Invalid size of SectionHeader");
}
================================================
FILE: vendor/pepp/misc/Address.hpp
================================================
#pragma once
#include "Concept.hpp"
namespace pepp {
template<typename ValueType = std::uintptr_t>
class Address
{
ValueType m_address;
public:
template<typename T>
constexpr Address(T value = 0) noexcept requires pepp::msc::MemoryAddress<T>
: m_address((ValueType)(value))
{
}
constexpr Address(const Address& rhs) = default;
~Address() = default;
Address& operator=(const Address& rhs) noexcept
{
m_address = rhs.m_address;
return *this;
}
constexpr explicit operator std::uintptr_t() const noexcept
{
return m_address;
}
constexpr ValueType uintptr() const noexcept
{
return m_address;
}
template<typename C>
C* as_ptr() noexcept requires pepp::msc::MemoryAddress<C*>
{
return reinterpret_cast<C*>(m_address);
}
template<typename C>
C as() noexcept
{
return (C)m_address;
}
template<typename C>
C& deref() noexcept
{
return *reinterpret_cast<C*>(m_address);
}
/*
*! Comparison operators
*/
constexpr bool operator==(const Address& rhs) const noexcept
{
return m_address == rhs.m_address;
}
constexpr bool operator!=(const Address& rhs) const noexcept
{
return m_address != rhs.m_address;
}
constexpr bool operator>=(const Address& rhs) const noexcept
{
return m_address >= rhs.m_address;
}
constexpr bool operator<=(const Address& rhs) const noexcept
{
return m_address <= rhs.m_address;
}
constexpr bool operator>(const Address& rhs) const noexcept
{
return m_address > rhs.m_address;
}
constexpr bool operator<(const Address& rhs) const noexcept
{
return m_address < rhs.m_address;
}
/*
/! Arithmetic operators
*/
constexpr Address operator+(const Address& rhs) const noexcept
{
return m_address + rhs.m_address;
}
constexpr Address operator-(const Address& rhs) const noexcept
{
return m_address - rhs.m_address;
}
constexpr Address operator*(const Address& rhs) const noexcept
{
return m_address * rhs.m_address;
}
constexpr Address operator/(const Address& rhs) const noexcept
{
return m_address / rhs.m_address;
}
/*
/!
*/
constexpr Address& operator+=(const Address& rhs) noexcept
{
m_address += rhs.m_address;
return *this;
}
constexpr Address& operator-=(const Address& rhs) noexcept
{
m_address -= rhs.m_address;
return *this;
}
constexpr Address& operator*=(const Address& rhs) noexcept
{
m_address *= rhs.m_address;
return *this;
}
/*
/! Bitwise operators
*/
constexpr Address operator>>(const Address& rhs) const noexcept
{
return m_address >> rhs.m_address;
}
constexpr Address operator<<(const Address& rhs) const noexcept
{
return m_address << rhs.m_address;
}
constexpr Address operator^(const Address& rhs) const noexcept
{
return m_address ^ rhs.m_address;
}
constexpr Address operator&(const Address& rhs) const noexcept
{
return m_address & rhs.m_address;
}
constexpr Address operator|(const Address& rhs) const noexcept
{
return m_address | rhs.m_address;
}
/*
/!
*/
constexpr Address& operator>>=(const Address& rhs) noexcept
{
m_address >>= rhs.m_address;
return *this;
}
constexpr Address& operator<<=(const Address& rhs) noexcept
{
m_address <<= rhs.m_address;
return *this;
}
constexpr Address& operator^=(const Address& rhs) noexcept
{
m_address ^= rhs.m_address;
return *this;
}
constexpr Address& operator&=(const Address& rhs) noexcept
{
m_address &= rhs.m_address;
return *this;
}
constexpr Address& operator|=(const Address& rhs) noexcept
{
m_address |= rhs.m_address;
return *this;
}
};
}
================================================
FILE: vendor/pepp/misc/ByteVector.hpp
================================================
#pragma once
#include <vector>
namespace pepp::mem {
class ByteVector : public std::vector<std::uint8_t>
{
public:
//
//! Used for pushing a single byte.
//! Example: push(0x55)
//
constexpr ByteVector& push_byte(std::uint8_t byte) {
push_back(byte);
return *this;
}
//
//! Used for pushing raw data
//! Example: push_raw(data, size)
//
template<typename T>
constexpr ByteVector& push_raw(const T* data, std::size_t rsize) {
resize(size() + rsize);
memcpy(&(*this)[size() - rsize], data, rsize);
return *this;
}
//
//! Used for pushing a container.
//! Example: push_container(array/vector/etc)
//
template<typename T>
constexpr ByteVector& push_container(const T& container) {
for (auto c : container)
push_back(static_cast<std::uint8_t>(c));
return *this;
}
//
//! Used for pushing a raw array.
//! Example: push_array({0x55, 0x8b, 0xec})
//
template<typename T>
constexpr ByteVector& push_array(const std::initializer_list<T>& list) requires std::convertible_to<T, std::uint8_t> {
for (auto c : list)
push_back(static_cast<std::uint8_t>(c));
return *this;
}
//
//! Used for pushing a iterator range.
//! Example: push_range(c.begin(), c.end())
//
template<typename iterator_t>
constexpr ByteVector& push_range(iterator_t first, iterator_t last) {
while (first != last) {
push_back(static_cast<std::uint8_t>(*first));
first++;
}
return *this;
}
//
//! Used for pushing arguments.
//! Example: push_args(0x55, 0x8b, 0xec)
//
constexpr ByteVector& push_args(std::convertible_to<std::uint8_t> auto... args) {
for (auto arg : { args... })
push_back(static_cast<std::uint8_t>(arg));
return *this;
}
//
//! Push a double dword
//! Example: push_dword(0xdeadbeef) ..
//
constexpr ByteVector& push_dword(std::uint32_t dword) {
push_back(static_cast<std::uint8_t>(dword & 0xFF));
push_back(static_cast<std::uint8_t>((dword >> 8) & 0xFF));
push_back(static_cast<std::uint8_t>((dword >> 16) & 0xFF));
push_back(static_cast<std::uint8_t>((dword >> 24) & 0xFF));
return *this;
}
//
//! Push a quad word
//! Example: push_qword(0x1122334411223344) ..
//
constexpr ByteVector& push_qword(std::uint64_t qword) {
push_back(static_cast<std::uint8_t>(qword & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 8) & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 16) & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 24) & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 32) & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 40) & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 48) & 0xFF));
push_back(static_cast<std::uint8_t>((qword >> 56) & 0xFF));
return *this;
}
//
//! Copy in data at specified index
//! Example: copy_data(0, data, size)
//
template<typename T>
ByteVector& copy_data(std::size_t idx, const T* data, std::size_t rsize) {
if (size() > idx) {
std::memcpy(&(*this)[idx], data, rsize);
}
return *this;
}
//
//! Add/insert in data at specified index
//! Example: insert_data(0, data, size)
//
template<typename T>
ByteVector& insert_data(std::size_t idx, const T* data, std::size_t rsize) {
if (size() <= idx)
resize(idx);
insert(begin() + idx, rsize, 0x0);
memcpy(&(*this)[idx], data, rsize);
return *this;
}
//
//! Interpret data as T
//! Example: as<char*>(0x0/)
//
template<typename T>
T as(std::size_t idx = 0x0) const {
return (T)(&at(idx));
}
template<typename T>
T as(std::size_t idx = 0x0) {
return (T)(&at(idx));
}
//
//! Dereference bytes as T
//! Example: deref<char*>(0x0/)
//
template<typename T>
T deref(std::size_t idx = 0x0) const {
return *(T*)(&at(idx));
}
};
}
================================================
FILE: vendor/pepp/misc/Concept.hpp
================================================
#pragma once
#include <type_traits>
namespace pepp::msc
{
template <class T>
concept Arithmetic = std::is_arithmetic_v<T>;
template <class T>
concept MemoryAddress = std::is_integral_v<T> || std::is_pointer_v<T>;
}
================================================
FILE: vendor/pepp/misc/File.cpp
================================================
#include <iostream>
#include <string>
#include <fstream>
#include <filesystem>
#include <vector>
#include "File.hpp"
namespace pepp::io {
File::File(std::string_view filename, int flags)
: m_filename(filename)
, m_flags(flags)
{
}
File::File(File&& other)
: m_filename(std::move(other.m_filename))
, m_flags(other.m_flags)
{
}
void File::Write(std::string_view text)
{
m_out_file.open(m_filename, m_flags & ~FILE_INPUT);
if (m_out_file.is_open()) {
m_out_file << text;
m_out_file.close();
}
}
void File::Write(const std::vector<std::uint8_t>& data)
{
m_out_file.open(m_filename, m_flags & ~FILE_INPUT);
if (m_out_file.is_open()) {
m_out_file.write((const char*)data.data(), data.size());
m_out_file.close();
}
}
std::vector<std::uint8_t> File::Read()
{
std::vector<std::uint8_t> file_buffer;
m_in_file.open(m_filename, m_flags & ~FILE_OUTPUT);
if (m_in_file.is_open()) {
file_buffer = std::vector<std::uint8_t>(std::istreambuf_iterator<char>(m_in_file), {});
m_in_file.close();
}
return file_buffer;
}
std::uintmax_t File::GetSize()
{
return std::filesystem::file_size(m_filename);
}
File& io::File::operator=(File&& rhs)
{
if (this == &rhs)
return *this;
std::swap(m_filename, rhs.m_filename);
std::swap(m_flags, rhs.m_flags);
return *this;
}
}
================================================
FILE: vendor/pepp/misc/File.hpp
================================================
#pragma once
#include <fstream>
namespace pepp::io
{
enum FileFlags {
FILE_INPUT = 1,
FILE_OUTPUT = 2,
FILE_APP = 8,
FILE_TRUNC = 16,
FILE_BINARY = 32
};
class File {
public:
File() = default;
File(const File& other) = default;
File(std::string_view filename, int flags);
File(File&& other);
void Write(std::string_view text);
void Write(const std::vector<std::uint8_t>& data);
std::vector<std::uint8_t> Read();
std::uintmax_t GetSize();
File& operator=(File&& rhs);
private:
std::string m_filename;
int m_flags;
std::ofstream m_out_file;
std::ifstream m_in_file;
};
}
================================================
FILE: vendor/pepp/misc/NonCopyable.hpp
================================================
#pragma once
namespace pepp::msc
{
class NonCopyable {
public:
NonCopyable() = default;
NonCopyable(const NonCopyable&) = delete;
NonCopyable& operator=(const NonCopyable&) = delete;
};
}
================================================
FILE: vendor/spdlog/include/spdlog/async.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
//
// Async logging using global thread pool
// All loggers created here share same global thread pool.
// Each log message is pushed to a queue along with a shared pointer to the
// logger.
// If a logger deleted while having pending messages in the queue, it's actual
// destruction will defer
// until all its messages are processed by the thread pool.
// This is because each message in the queue holds a shared_ptr to the
// originating logger.
#include <spdlog/async_logger.h>
#include <spdlog/details/registry.h>
#include <spdlog/details/thread_pool.h>
#include <memory>
#include <mutex>
#include <functional>
namespace spdlog {
namespace details {
static const size_t default_async_q_size = 8192;
}
// async logger factory - creates async loggers backed with thread pool.
// if a global thread pool doesn't already exist, create it with default queue
// size of 8192 items and single thread.
template<async_overflow_policy OverflowPolicy = async_overflow_policy::block>
struct async_factory_impl
{
template<typename Sink, typename... SinkArgs>
static std::shared_ptr<async_logger> create(std::string logger_name, SinkArgs &&...args)
{
auto ®istry_inst = details::registry::instance();
// create global thread pool if not already exists..
auto &mutex = registry_inst.tp_mutex();
std::lock_guard<std::recursive_mutex> tp_lock(mutex);
auto tp = registry_inst.get_tp();
if (tp == nullptr)
{
tp = std::make_shared<details::thread_pool>(details::default_async_q_size, 1U);
registry_inst.set_tp(tp);
}
auto sink = std::make_shared<Sink>(std::forward<SinkArgs>(args)...);
auto new_logger = std::make_shared<async_logger>(std::move(logger_name), std::move(sink), std::move(tp), OverflowPolicy);
registry_inst.initialize_logger(new_logger);
return new_logger;
}
};
using async_factory = async_factory_impl<async_overflow_policy::block>;
using async_factory_nonblock = async_factory_impl<async_overflow_policy::overrun_oldest>;
template<typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create_async(std::string logger_name, SinkArgs &&...sink_args)
{
return async_factory::create<Sink>(std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
}
template<typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create_async_nb(std::string logger_name, SinkArgs &&...sink_args)
{
return async_factory_nonblock::create<Sink>(std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
}
// set global thread pool.
inline void init_thread_pool(size_t q_size, size_t thread_count, std::function<void()> on_thread_start)
{
auto tp = std::make_shared<details::thread_pool>(q_size, thread_count, on_thread_start);
details::registry::instance().set_tp(std::move(tp));
}
// set global thread pool.
inline void init_thread_pool(size_t q_size, size_t thread_count)
{
init_thread_pool(q_size, thread_count, [] {});
}
// get the global thread pool.
inline std::shared_ptr<spdlog::details::thread_pool> thread_pool()
{
return details::registry::instance().get_tp();
}
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/async_logger-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/async_logger.h>
#endif
#include <spdlog/sinks/sink.h>
#include <spdlog/details/thread_pool.h>
#include <memory>
#include <string>
SPDLOG_INLINE spdlog::async_logger::async_logger(
std::string logger_name, sinks_init_list sinks_list, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy)
: async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), std::move(tp), overflow_policy)
{}
SPDLOG_INLINE spdlog::async_logger::async_logger(
std::string logger_name, sink_ptr single_sink, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy)
: async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy)
{}
// send the log message to the thread pool
SPDLOG_INLINE void spdlog::async_logger::sink_it_(const details::log_msg &msg)
{
if (auto pool_ptr = thread_pool_.lock())
{
pool_ptr->post_log(shared_from_this(), msg, overflow_policy_);
}
else
{
throw_spdlog_ex("async log: thread pool doesn't exist anymore");
}
}
// send flush request to the thread pool
SPDLOG_INLINE void spdlog::async_logger::flush_()
{
if (auto pool_ptr = thread_pool_.lock())
{
pool_ptr->post_flush(shared_from_this(), overflow_policy_);
}
else
{
throw_spdlog_ex("async flush: thread pool doesn't exist anymore");
}
}
//
// backend functions - called from the thread pool to do the actual job
//
SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg)
{
for (auto &sink : sinks_)
{
if (sink->should_log(msg.level))
{
SPDLOG_TRY
{
sink->log(msg);
}
SPDLOG_LOGGER_CATCH()
}
}
if (should_flush_(msg))
{
backend_flush_();
}
}
SPDLOG_INLINE void spdlog::async_logger::backend_flush_()
{
for (auto &sink : sinks_)
{
SPDLOG_TRY
{
sink->flush();
}
SPDLOG_LOGGER_CATCH()
}
}
SPDLOG_INLINE std::shared_ptr<spdlog::logger> spdlog::async_logger::clone(std::string new_name)
{
auto cloned = std::make_shared<spdlog::async_logger>(*this);
cloned->name_ = std::move(new_name);
return cloned;
}
================================================
FILE: vendor/spdlog/include/spdlog/async_logger.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
// Fast asynchronous logger.
// Uses pre allocated queue.
// Creates a single back thread to pop messages from the queue and log them.
//
// Upon each log write the logger:
// 1. Checks if its log level is enough to log the message
// 2. Push a new copy of the message to a queue (or block the caller until
// space is available in the queue)
// Upon destruction, logs all remaining messages in the queue before
// destructing..
#include <spdlog/logger.h>
namespace spdlog {
// Async overflow policy - block by default.
enum class async_overflow_policy
{
block, // Block until message can be enqueued
overrun_oldest // Discard oldest message in the queue if full when trying to
// add new item.
};
namespace details {
class thread_pool;
}
class SPDLOG_API async_logger final : public std::enable_shared_from_this<async_logger>, public logger
{
friend class details::thread_pool;
public:
template<typename It>
async_logger(std::string logger_name, It begin, It end, std::weak_ptr<details::thread_pool> tp,
async_overflow_policy overflow_policy = async_overflow_policy::block)
: logger(std::move(logger_name), begin, end)
, thread_pool_(std::move(tp))
, overflow_policy_(overflow_policy)
{}
async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr<details::thread_pool> tp,
async_overflow_policy overflow_policy = async_overflow_policy::block);
async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr<details::thread_pool> tp,
async_overflow_policy overflow_policy = async_overflow_policy::block);
std::shared_ptr<logger> clone(std::string new_name) override;
protected:
void sink_it_(const details::log_msg &msg) override;
void flush_() override;
void backend_sink_it_(const details::log_msg &incoming_log_msg);
void backend_flush_();
private:
std::weak_ptr<details::thread_pool> thread_pool_;
async_overflow_policy overflow_policy_;
};
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "async_logger-inl.h"
#endif
================================================
FILE: vendor/spdlog/include/spdlog/cfg/argv.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/cfg/helpers.h>
#include <spdlog/details/registry.h>
//
// Init log levels using each argv entry that starts with "SPDLOG_LEVEL="
//
// set all loggers to debug level:
// example.exe "SPDLOG_LEVEL=debug"
// set logger1 to trace level
// example.exe "SPDLOG_LEVEL=logger1=trace"
// turn off all logging except for logger1 and logger2:
// example.exe "SPDLOG_LEVEL=off,logger1=debug,logger2=info"
namespace spdlog {
namespace cfg {
// search for SPDLOG_LEVEL= in the args and use it to init the levels
inline void load_argv_levels(int argc, const char **argv)
{
const std::string spdlog_level_prefix = "SPDLOG_LEVEL=";
for (int i = 1; i < argc; i++)
{
std::string arg = argv[i];
if (arg.find(spdlog_level_prefix) == 0)
{
auto levels_string = arg.substr(spdlog_level_prefix.size());
helpers::load_levels(levels_string);
}
}
}
inline void load_argv_levels(int argc, char **argv)
{
load_argv_levels(argc, const_cast<const char **>(argv));
}
} // namespace cfg
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/cfg/env.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/cfg/helpers.h>
#include <spdlog/details/registry.h>
#include <spdlog/details/os.h>
//
// Init levels and patterns from env variables SPDLOG_LEVEL
// Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger).
// Note - fallback to "info" level on unrecognized levels
//
// Examples:
//
// set global level to debug:
// export SPDLOG_LEVEL=debug
//
// turn off all logging except for logger1:
// export SPDLOG_LEVEL="*=off,logger1=debug"
//
// turn off all logging except for logger1 and logger2:
// export SPDLOG_LEVEL="off,logger1=debug,logger2=info"
namespace spdlog {
namespace cfg {
inline void load_env_levels()
{
auto env_val = details::os::getenv("SPDLOG_LEVEL");
if (!env_val.empty())
{
helpers::load_levels(env_val);
}
}
} // namespace cfg
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/cfg/helpers-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/cfg/helpers.h>
#endif
#include <spdlog/spdlog.h>
#include <spdlog/details/os.h>
#include <spdlog/details/registry.h>
#include <algorithm>
#include <string>
#include <utility>
#include <sstream>
namespace spdlog {
namespace cfg {
namespace helpers {
// inplace convert to lowercase
inline std::string &to_lower_(std::string &str)
{
std::transform(
str.begin(), str.end(), str.begin(), [](char ch) { return static_cast<char>((ch >= 'A' && ch <= 'Z') ? ch + ('a' - 'A') : ch); });
return str;
}
// inplace trim spaces
inline std::string &trim_(std::string &str)
{
const char *spaces = " \n\r\t";
str.erase(str.find_last_not_of(spaces) + 1);
str.erase(0, str.find_first_not_of(spaces));
return str;
}
// return (name,value) trimmed pair from given "name=value" string.
// return empty string on missing parts
// "key=val" => ("key", "val")
// " key = val " => ("key", "val")
// "key=" => ("key", "")
// "val" => ("", "val")
inline std::pair<std::string, std::string> extract_kv_(char sep, const std::string &str)
{
auto n = str.find(sep);
std::string k, v;
if (n == std::string::npos)
{
v = str;
}
else
{
k = str.substr(0, n);
v = str.substr(n + 1);
}
return std::make_pair(trim_(k), trim_(v));
}
// return vector of key/value pairs from sequence of "K1=V1,K2=V2,.."
// "a=AAA,b=BBB,c=CCC,.." => {("a","AAA"),("b","BBB"),("c", "CCC"),...}
inline std::unordered_map<std::string, std::string> extract_key_vals_(const std::string &str)
{
std::string token;
std::istringstream token_stream(str);
std::unordered_map<std::string, std::string> rv{};
while (std::getline(token_stream, token, ','))
{
if (token.empty())
{
continue;
}
auto kv = extract_kv_('=', token);
rv[kv.first] = kv.second;
}
return rv;
}
SPDLOG_INLINE void load_levels(const std::string &input)
{
if (input.empty() || input.size() > 512)
{
return;
}
auto key_vals = extract_key_vals_(input);
std::unordered_map<std::string, level::level_enum> levels;
level::level_enum global_level = level::info;
bool global_level_found = false;
for (auto &name_level : key_vals)
{
auto &logger_name = name_level.first;
auto level_name = to_lower_(name_level.second);
auto level = level::from_str(level_name);
// ignore unrecognized level names
if (level == level::off && level_name != "off")
{
continue;
}
if (logger_name.empty()) // no logger name indicate global level
{
global_level_found = true;
global_level = level;
}
else
{
levels[logger_name] = level;
}
}
details::registry::instance().set_levels(std::move(levels), global_level_found ? &global_level : nullptr);
}
} // namespace helpers
} // namespace cfg
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/cfg/helpers.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/common.h>
#include <unordered_map>
namespace spdlog {
namespace cfg {
namespace helpers {
//
// Init levels from given string
//
// Examples:
//
// set global level to debug: "debug"
// turn off all logging except for logger1: "off,logger1=debug"
// turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info"
//
SPDLOG_API void load_levels(const std::string &txt);
} // namespace helpers
} // namespace cfg
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "helpers-inl.h"
#endif // SPDLOG_HEADER_ONLY
================================================
FILE: vendor/spdlog/include/spdlog/common-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/common.h>
#endif
#include <algorithm>
#include <iterator>
namespace spdlog {
namespace level {
#if __cplusplus >= 201703L
constexpr
#endif
static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
{
return level_string_views[l];
}
SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
{
return short_level_names[l];
}
SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
{
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
if (it != std::end(level_string_views))
return static_cast<level::level_enum>(std::distance(std::begin(level_string_views), it));
// check also for "warn" and "err" before giving up..
if (name == "warn")
{
return level::warn;
}
if (name == "err")
{
return level::err;
}
return level::off;
}
} // namespace level
SPDLOG_INLINE spdlog_ex::spdlog_ex(std::string msg)
: msg_(std::move(msg))
{}
SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
{
memory_buf_t outbuf;
fmt::format_system_error(outbuf, last_errno, msg.c_str());
msg_ = fmt::to_string(outbuf);
}
SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT
{
return msg_.c_str();
}
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
{
SPDLOG_THROW(spdlog_ex(msg, last_errno));
}
SPDLOG_INLINE void throw_spdlog_ex(std::string msg)
{
SPDLOG_THROW(spdlog_ex(std::move(msg)));
}
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/common.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/tweakme.h>
#include <spdlog/details/null_mutex.h>
#include <atomic>
#include <chrono>
#include <initializer_list>
#include <memory>
#include <exception>
#include <string>
#include <type_traits>
#include <functional>
#ifdef SPDLOG_COMPILED_LIB
# undef SPDLOG_HEADER_ONLY
# if defined(_WIN32) && defined(SPDLOG_SHARED_LIB)
# ifdef spdlog_EXPORTS
# define SPDLOG_API __declspec(dllexport)
# else
# define SPDLOG_API __declspec(dllimport)
# endif
# else // !defined(_WIN32) || !defined(SPDLOG_SHARED_LIB)
# define SPDLOG_API
# endif
# define SPDLOG_INLINE
#else // !defined(SPDLOG_COMPILED_LIB)
# define SPDLOG_API
# define SPDLOG_HEADER_ONLY
# define SPDLOG_INLINE inline
#endif // #ifdef SPDLOG_COMPILED_LIB
#include <spdlog/fmt/fmt.h>
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
# include <spdlog/fmt/xchar.h>
#endif
// visual studio upto 2013 does not support noexcept nor constexpr
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SPDLOG_NOEXCEPT _NOEXCEPT
# define SPDLOG_CONSTEXPR
#else
# define SPDLOG_NOEXCEPT noexcept
# define SPDLOG_CONSTEXPR constexpr
#endif
#if defined(__GNUC__) || defined(__clang__)
# define SPDLOG_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
# define SPDLOG_DEPRECATED __declspec(deprecated)
#else
# define SPDLOG_DEPRECATED
#endif
// disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS
# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
# define SPDLOG_NO_TLS 1
# endif
#endif
#ifndef SPDLOG_FUNCTION
# define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
#endif
#ifdef SPDLOG_NO_EXCEPTIONS
# define SPDLOG_TRY
# define SPDLOG_THROW(ex) \
do \
{ \
printf("spdlog fatal error: %s\n", ex.what()); \
std::abort(); \
} while (0)
# define SPDLOG_CATCH_STD
#else
# define SPDLOG_TRY try
# define SPDLOG_THROW(ex) throw(ex)
# define SPDLOG_CATCH_STD \
catch (const std::exception &) {}
#endif
namespace spdlog {
class formatter;
namespace sinks {
class sink;
}
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
using filename_t = std::wstring;
// allow macro expansion to occur in SPDLOG_FILENAME_T
# define SPDLOG_FILENAME_T_INNER(s) L##s
# define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
#else
using filename_t = std::string;
# define SPDLOG_FILENAME_T(s) s
#endif
using log_clock = std::chrono::system_clock;
using sink_ptr = std::shared_ptr<sinks::sink>;
using sinks_init_list = std::initializer_list<sink_ptr>;
using err_handler = std::function<void(const std::string &err_msg)>;
using string_view_t = fmt::basic_string_view<char>;
using wstring_view_t = fmt::basic_string_view<wchar_t>;
using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
using wmemory_buf_t = fmt::basic_memory_buffer<wchar_t, 250>;
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
# ifndef _WIN32
# error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
# else
template<typename T>
struct is_convertible_to_wstring_view : std::is_convertible<T, wstring_view_t>
{};
# endif // _WIN32
#else
template<typename>
struct is_convertible_to_wstring_view : std::false_type
{};
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
#if defined(SPDLOG_NO_ATOMIC_LEVELS)
using level_t = details::null_atomic_int;
#else
using level_t = std::atomic<int>;
#endif
#define SPDLOG_LEVEL_TRACE 0
#define SPDLOG_LEVEL_DEBUG 1
#define SPDLOG_LEVEL_INFO 2
#define SPDLOG_LEVEL_WARN 3
#define SPDLOG_LEVEL_ERROR 4
#define SPDLOG_LEVEL_CRITICAL 5
#define SPDLOG_LEVEL_OFF 6
#if !defined(SPDLOG_ACTIVE_LEVEL)
# define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
#endif
// Log level enum
namespace level {
enum level_enum
{
trace = SPDLOG_LEVEL_TRACE,
debug = SPDLOG_LEVEL_DEBUG,
info = SPDLOG_LEVEL_INFO,
warn = SPDLOG_LEVEL_WARN,
err = SPDLOG_LEVEL_ERROR,
critical = SPDLOG_LEVEL_CRITICAL,
off = SPDLOG_LEVEL_OFF,
n_levels
};
#define SPDLOG_LEVEL_NAME_TRACE string_view_t("trace", 5)
#define SPDLOG_LEVEL_NAME_DEBUG string_view_t("debug", 5)
#define SPDLOG_LEVEL_NAME_INFO string_view_t("info", 4)
#define SPDLOG_LEVEL_NAME_WARNING string_view_t("warning", 7)
#define SPDLOG_LEVEL_NAME_ERROR string_view_t("error", 5)
#define SPDLOG_LEVEL_NAME_CRITICAL string_view_t("critical", 8)
#define SPDLOG_LEVEL_NAME_OFF string_view_t("off", 3)
#if !defined(SPDLOG_LEVEL_NAMES)
# define SPDLOG_LEVEL_NAMES \
{ \
SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, \
SPDLOG_LEVEL_NAME_CRITICAL, SPDLOG_LEVEL_NAME_OFF \
}
#endif
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
# define SPDLOG_SHORT_LEVEL_NAMES \
{ \
"T", "D", "I", "W", "E", "C", "O" \
}
#endif
SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
} // namespace level
//
// Color mode used by sinks with color support.
//
enum class color_mode
{
always,
automatic,
never
};
//
// Pattern time - specific time getting to use for pattern_formatter.
// local time by default
//
enum class pattern_time_type
{
local, // log localtime
utc // log utc
};
//
// Log exception
//
class SPDLOG_API spdlog_ex : public std::exception
{
public:
explicit spdlog_ex(std::string msg);
spdlog_ex(const std::string &msg, int last_errno);
const char *what() const SPDLOG_NOEXCEPT override;
private:
std::string msg_;
};
[[noreturn]] SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno);
[[noreturn]] SPDLOG_API void throw_spdlog_ex(std::string msg);
struct source_loc
{
SPDLOG_CONSTEXPR source_loc() = default;
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)
: filename{filename_in}
, line{line_in}
, funcname{funcname_in}
{}
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
{
return line == 0;
}
const char *filename{nullptr};
int line{0};
const char *funcname{nullptr};
};
namespace details {
// make_unique support for pre c++14
#if __cplusplus >= 201402L // C++14 and beyond
using std::make_unique;
#else
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args &&...args)
{
static_assert(!std::is_array<T>::value, "arrays not supported");
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
# include "common-inl.h"
#endif
================================================
FILE: vendor/spdlog/include/spdlog/details/backtracer-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/details/backtracer.h>
#endif
namespace spdlog {
namespace details {
SPDLOG_INLINE backtracer::backtracer(const backtracer &other)
{
std::lock_guard<std::mutex> lock(other.mutex_);
enabled_ = other.enabled();
messages_ = other.messages_;
}
SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT
{
std::lock_guard<std::mutex> lock(other.mutex_);
enabled_ = other.enabled();
messages_ = std::move(other.messages_);
}
SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other)
{
std::lock_guard<std::mutex> lock(mutex_);
enabled_ = other.enabled();
messages_ = std::move(other.messages_);
return *this;
}
SPDLOG_INLINE void backtracer::enable(size_t size)
{
std::lock_guard<std::mutex> lock{mutex_};
enabled_.store(true, std::memory_order_relaxed);
messages_ = circular_q<log_msg_buffer>{size};
}
SPDLOG_INLINE void backtracer::disable()
{
std::lock_guard<std::mutex> lock{mutex_};
enabled_.store(false, std::memory_order_relaxed);
}
SPDLOG_INLINE bool backtracer::enabled() const
{
return enabled_.load(std::memory_order_relaxed);
}
SPDLOG_INLINE void backtracer::push_back(const log_msg &msg)
{
std::lock_guard<std::mutex> lock{mutex_};
messages_.push_back(log_msg_buffer{msg});
}
// pop all items in the q and apply the given fun on each of them.
SPDLOG_INLINE void backtracer::foreach_pop(std::function<void(const details::log_msg &)> fun)
{
std::lock_guard<std::mutex> lock{mutex_};
while (!messages_.empty())
{
auto &front_msg = messages_.front();
fun(front_msg);
messages_.pop_front();
}
}
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/backtracer.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/details/log_msg_buffer.h>
#include <spdlog/details/circular_q.h>
#include <atomic>
#include <mutex>
#include <functional>
// Store log messages in circular buffer.
// Useful for storing debug data in case of error/warning happens.
namespace spdlog {
namespace details {
class SPDLOG_API backtracer
{
mutable std::mutex mutex_;
std::atomic<bool> enabled_{false};
circular_q<log_msg_buffer> messages_;
public:
backtracer() = default;
backtracer(const backtracer &other);
backtracer(backtracer &&other) SPDLOG_NOEXCEPT;
backtracer &operator=(backtracer other);
void enable(size_t size);
void disable();
bool enabled() const;
void push_back(const log_msg &msg);
// pop all items in the q and apply the given fun on each of them.
void foreach_pop(std::function<void(const details::log_msg &)> fun);
};
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "backtracer-inl.h"
#endif
================================================
FILE: vendor/spdlog/include/spdlog/details/circular_q.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
// circular q view of std::vector.
#pragma once
#include <vector>
#include <cassert>
namespace spdlog {
namespace details {
template<typename T>
class circular_q
{
size_t max_items_ = 0;
typename std::vector<T>::size_type head_ = 0;
typename std::vector<T>::size_type tail_ = 0;
size_t overrun_counter_ = 0;
std::vector<T> v_;
public:
using value_type = T;
// empty ctor - create a disabled queue with no elements allocated at all
circular_q() = default;
explicit circular_q(size_t max_items)
: max_items_(max_items + 1) // one item is reserved as marker for full q
, v_(max_items_)
{}
circular_q(const circular_q &) = default;
circular_q &operator=(const circular_q &) = default;
// move cannot be default,
// since we need to reset head_, tail_, etc to zero in the moved object
circular_q(circular_q &&other) SPDLOG_NOEXCEPT
{
copy_moveable(std::move(other));
}
circular_q &operator=(circular_q &&other) SPDLOG_NOEXCEPT
{
copy_moveable(std::move(other));
return *this;
}
// push back, overrun (oldest) item if no room left
void push_back(T &&item)
{
if (max_items_ > 0)
{
v_[tail_] = std::move(item);
tail_ = (tail_ + 1) % max_items_;
if (tail_ == head_) // overrun last item if full
{
head_ = (head_ + 1) % max_items_;
++overrun_counter_;
}
}
}
// Return reference to the front item.
// If there are no elements in the container, the behavior is undefined.
const T &front() const
{
return v_[head_];
}
T &front()
{
return v_[head_];
}
// Return number of elements actually stored
size_t size() const
{
if (tail_ >= head_)
{
return tail_ - head_;
}
else
{
return max_items_ - (head_ - tail_);
}
}
// Return const reference to item by index.
// If index is out of range 0…size()-1, the behavior is undefined.
const T &at(size_t i) const
{
assert(i < size());
return v_[(head_ + i) % max_items_];
}
// Pop item from front.
// If there are no elements in the container, the behavior is undefined.
void pop_front()
{
head_ = (head_ + 1) % max_items_;
}
bool empty() const
{
return tail_ == head_;
}
bool full() const
{
// head is ahead of the tail by 1
if (max_items_ > 0)
{
return ((tail_ + 1) % max_items_) == head_;
}
return false;
}
size_t overrun_counter() const
{
return overrun_counter_;
}
private:
// copy from other&& and reset it to disabled state
void copy_moveable(circular_q &&other) SPDLOG_NOEXCEPT
{
max_items_ = other.max_items_;
head_ = other.head_;
tail_ = other.tail_;
overrun_counter_ = other.overrun_counter_;
v_ = std::move(other.v_);
// put &&other in disabled, but valid state
other.max_items_ = 0;
other.head_ = other.tail_ = 0;
other.overrun_counter_ = 0;
}
};
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/console_globals.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/details/null_mutex.h>
#include <mutex>
namespace spdlog {
namespace details {
struct console_mutex
{
using mutex_t = std::mutex;
static mutex_t &mutex()
{
static mutex_t s_mutex;
return s_mutex;
}
};
struct console_nullmutex
{
using mutex_t = null_mutex;
static mutex_t &mutex()
{
static mutex_t s_mutex;
return s_mutex;
}
};
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/file_helper-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/details/file_helper.h>
#endif
#include <spdlog/details/os.h>
#include <spdlog/common.h>
#include <cerrno>
#include <chrono>
#include <cstdio>
#include <string>
#include <thread>
#include <tuple>
namespace spdlog {
namespace details {
SPDLOG_INLINE file_helper::~file_helper()
{
close();
}
SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
{
close();
filename_ = fname;
auto *mode = SPDLOG_FILENAME_T("ab");
auto *trunc_mode = SPDLOG_FILENAME_T("wb");
for (int tries = 0; tries < open_tries_; ++tries)
{
// create containing folder if not exists already.
os::create_dir(os::dir_name(fname));
if (truncate)
{
// Truncate by opening-and-closing a tmp file in "wb" mode, always
// opening the actual log-we-write-to in "ab" mode, since that
// interacts more politely with eternal processes that might
// rotate/truncate the file underneath us.
std::FILE *tmp;
if (os::fopen_s(&tmp, fname, trunc_mode))
{
continue;
}
std::fclose(tmp);
}
if (!os::fopen_s(&fd_, fname, mode))
{
return;
}
details::os::sleep_for_millis(open_interval_);
}
throw_spdlog_ex("Failed opening file " + os::filename_to_str(filename_) + " for writing", errno);
}
SPDLOG_INLINE void file_helper::reopen(bool truncate)
{
if (filename_.empty())
{
throw_spdlog_ex("Failed re opening file - was not opened before");
}
this->open(filename_, truncate);
}
SPDLOG_INLINE void file_helper::flush()
{
std::fflush(fd_);
}
SPDLOG_INLINE void file_helper::close()
{
if (fd_ != nullptr)
{
std::fclose(fd_);
fd_ = nullptr;
}
}
SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf)
{
size_t msg_size = buf.size();
auto data = buf.data();
if (std::fwrite(data, 1, msg_size, fd_) != msg_size)
{
throw_spdlog_ex("Failed writing to file " + os::filename_to_str(filename_), errno);
}
}
SPDLOG_INLINE size_t file_helper::size() const
{
if (fd_ == nullptr)
{
throw_spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(filename_));
}
return os::filesize(fd_);
}
SPDLOG_INLINE const filename_t &file_helper::filename() const
{
return filename_;
}
//
// return file path and its extension:
//
// "mylog.txt" => ("mylog", ".txt")
// "mylog" => ("mylog", "")
// "mylog." => ("mylog.", "")
// "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt")
//
// the starting dot in filenames is ignored (hidden files):
//
// ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
SPDLOG_INLINE std::tuple<filename_t, filename_t> file_helper::split_by_extension(const filename_t &fname)
{
auto ext_index = fname.rfind('.');
// no valid extension found - return whole path and empty string as
// extension
if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1)
{
return std::make_tuple(fname, filename_t());
}
// treat cases like "/etc/rc.d/somelogfile or "/abc/.hiddenfile"
auto folder_index = fname.find_last_of(details::os::folder_seps_filename);
if (folder_index != filename_t::npos && folder_index >= ext_index - 1)
{
return std::make_tuple(fname, filename_t());
}
// finally - return a valid base and extension tuple
return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index));
}
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/file_helper.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/common.h>
#include <tuple>
namespace spdlog {
namespace details {
// Helper class for file sinks.
// When failing to open a file, retry several times(5) with a delay interval(10 ms).
// Throw spdlog_ex exception on errors.
class SPDLOG_API file_helper
{
public:
explicit file_helper() = default;
file_helper(const file_helper &) = delete;
file_helper &operator=(const file_helper &) = delete;
~file_helper();
void open(const filename_t &fname, bool truncate = false);
void reopen(bool truncate);
void flush();
void close();
void write(const memory_buf_t &buf);
size_t size() const;
const filename_t &filename() const;
//
// return file path and its extension:
//
// "mylog.txt" => ("mylog", ".txt")
// "mylog" => ("mylog", "")
// "mylog." => ("mylog.", "")
// "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt")
//
// the starting dot in filenames is ignored (hidden files):
//
// ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
static std::tuple<filename_t, filename_t> split_by_extension(const filename_t &fname);
private:
const int open_tries_ = 5;
const unsigned int open_interval_ = 10;
std::FILE *fd_{nullptr};
filename_t filename_;
};
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "file_helper-inl.h"
#endif
================================================
FILE: vendor/spdlog/include/spdlog/details/fmt_helper.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <chrono>
#include <type_traits>
#include <iterator>
#include <spdlog/fmt/fmt.h>
#include <spdlog/common.h>
// Some fmt helpers to efficiently format and pad ints and strings
namespace spdlog {
namespace details {
namespace fmt_helper {
inline spdlog::string_view_t to_string_view(const memory_buf_t &buf) SPDLOG_NOEXCEPT
{
return spdlog::string_view_t{buf.data(), buf.size()};
}
inline void append_string_view(spdlog::string_view_t view, memory_buf_t &dest)
{
auto *buf_ptr = view.data();
dest.append(buf_ptr, buf_ptr + view.size());
}
template<typename T>
inline void append_int(T n, memory_buf_t &dest)
{
fmt::format_int i(n);
dest.append(i.data(), i.data() + i.size());
}
template<typename T>
inline unsigned int count_digits(T n)
{
using count_type = typename std::conditional<(sizeof(T) > sizeof(uint32_t)), uint64_t, uint32_t>::type;
return static_cast<unsigned int>(fmt::
// fmt 7.0.0 renamed the internal namespace to detail.
// See: https://github.com/fmtlib/fmt/issues/1538
#if FMT_VERSION < 70000
internal
#else
detail
#endif
::count_digits(static_cast<count_type>(n)));
}
inline void pad2(int n, memory_buf_t &dest)
{
if (n >= 0 && n < 100) // 0-99
{
dest.push_back(static_cast<char>('0' + n / 10));
dest.push_back(static_cast<char>('0' + n % 10));
}
else // unlikely, but just in case, let fmt deal with it
{
fmt::format_to(std::back_inserter(dest), "{:02}", n);
}
}
template<typename T>
inline void pad_uint(T n, unsigned int width, memory_buf_t &dest)
{
static_assert(std::is_unsigned<T>::value, "pad_uint must get unsigned T");
for (auto digits = count_digits(n); digits < width; digits++)
{
dest.push_back('0');
}
append_int(n, dest);
}
template<typename T>
inline void pad3(T n, memory_buf_t &dest)
{
static_assert(std::is_unsigned<T>::value, "pad3 must get unsigned T");
if (n < 1000)
{
dest.push_back(static_cast<char>(n / 100 + '0'));
n = n % 100;
dest.push_back(static_cast<char>((n / 10) + '0'));
dest.push_back(static_cast<char>((n % 10) + '0'));
}
else
{
append_int(n, dest);
}
}
template<typename T>
inline void pad6(T n, memory_buf_t &dest)
{
pad_uint(n, 6, dest);
}
template<typename T>
inline void pad9(T n, memory_buf_t &dest)
{
pad_uint(n, 9, dest);
}
// return fraction of a second of the given time_point.
// e.g.
// fraction<std::milliseconds>(tp) -> will return the millis part of the second
template<typename ToDuration>
inline ToDuration time_fraction(log_clock::time_point tp)
{
using std::chrono::duration_cast;
using std::chrono::seconds;
auto duration = tp.time_since_epoch();
auto secs = duration_cast<seconds>(duration);
return duration_cast<ToDuration>(duration) - duration_cast<ToDuration>(secs);
}
} // namespace fmt_helper
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/log_msg-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/details/log_msg.h>
#endif
#include <spdlog/details/os.h>
namespace spdlog {
namespace details {
SPDLOG_INLINE log_msg::log_msg(spdlog::log_clock::time_point log_time, spdlog::source_loc loc, string_view_t a_logger_name,
spdlog::level::level_enum lvl, spdlog::string_view_t msg)
: logger_name(a_logger_name)
, level(lvl)
, time(log_time)
#ifndef SPDLOG_NO_THREAD_ID
, thread_id(os::thread_id())
#endif
, source(loc)
, payload(msg)
{}
SPDLOG_INLINE log_msg::log_msg(
spdlog::source_loc loc, string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg)
: log_msg(os::now(), loc, a_logger_name, lvl, msg)
{}
SPDLOG_INLINE log_msg::log_msg(string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg)
: log_msg(os::now(), source_loc{}, a_logger_name, lvl, msg)
{}
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/log_msg.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/common.h>
#include <string>
namespace spdlog {
namespace details {
struct SPDLOG_API log_msg
{
log_msg() = default;
log_msg(log_clock::time_point log_time, source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg);
log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg);
log_msg(string_view_t logger_name, level::level_enum lvl, string_view_t msg);
log_msg(const log_msg &other) = default;
log_msg &operator=(const log_msg &other) = default;
string_view_t logger_name;
level::level_enum level{level::off};
log_clock::time_point time;
size_t thread_id{0};
// wrapping the formatted text with color (updated by pattern_formatter).
mutable size_t color_range_start{0};
mutable size_t color_range_end{0};
source_loc source;
string_view_t payload;
};
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "log_msg-inl.h"
#endif
================================================
FILE: vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/details/log_msg_buffer.h>
#endif
namespace spdlog {
namespace details {
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg)
: log_msg{orig_msg}
{
buffer.append(logger_name.begin(), logger_name.end());
buffer.append(payload.begin(), payload.end());
update_string_views();
}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
: log_msg{other}
{
buffer.append(logger_name.begin(), logger_name.end());
buffer.append(payload.begin(), payload.end());
update_string_views();
}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT
: log_msg{other}
, buffer{std::move(other.buffer)}
{
update_string_views();
}
SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &other)
{
log_msg::operator=(other);
buffer.clear();
buffer.append(other.buffer.data(), other.buffer.data() + other.buffer.size());
update_string_views();
return *this;
}
SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT
{
log_msg::operator=(other);
buffer = std::move(other.buffer);
update_string_views();
return *this;
}
SPDLOG_INLINE void log_msg_buffer::update_string_views()
{
logger_name = string_view_t{buffer.data(), logger_name.size()};
payload = string_view_t{buffer.data() + logger_name.size(), payload.size()};
}
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/log_msg_buffer.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <spdlog/details/log_msg.h>
namespace spdlog {
namespace details {
// Extend log_msg with internal buffer to store its payload.
// This is needed since log_msg holds string_views that points to stack data.
class SPDLOG_API log_msg_buffer : public log_msg
{
memory_buf_t buffer;
void update_string_views();
public:
log_msg_buffer() = default;
explicit log_msg_buffer(const log_msg &orig_msg);
log_msg_buffer(const log_msg_buffer &other);
log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
log_msg_buffer &operator=(const log_msg_buffer &other);
log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT;
};
} // namespace details
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "log_msg_buffer-inl.h"
#endif
================================================
FILE: vendor/spdlog/include/spdlog/details/mpmc_blocking_q.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
// multi producer-multi consumer blocking queue.
// enqueue(..) - will block until room found to put the new message.
// enqueue_nowait(..) - will return immediately with false if no room left in
// the queue.
// dequeue_for(..) - will block until the queue is not empty or timeout have
// passed.
#include <spdlog/details/circular_q.h>
#include <condition_variable>
#include <mutex>
namespace spdlog {
namespace details {
template<typename T>
class mpmc_blocking_queue
{
public:
using item_type = T;
explicit mpmc_blocking_queue(size_t max_items)
: q_(max_items)
{}
#ifndef __MINGW32__
// try to enqueue and block if no room left
void enqueue(T &&item)
{
{
std::unique_lock<std::mutex> lock(queue_mutex_);
pop_cv_.wait(lock, [this] { return !this->q_.full(); });
q_.push_back(std::move(item));
}
push_cv_.notify_one();
}
// enqueue immediately. overrun oldest message in the queue if no room left.
void enqueue_nowait(T &&item)
{
{
std::unique_lock<std::mutex> lock(queue_mutex_);
q_.push_back(std::move(item));
}
push_cv_.notify_one();
}
// try to dequeue item. if no item found. wait upto timeout and try again
// Return true, if succeeded dequeue item, false otherwise
bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration)
{
{
std::unique_lock<std::mutex> lock(queue_mutex_);
if (!push_cv_.wait_for(lock, wait_duration, [this] { return !this->q_.empty(); }))
{
return false;
}
popped_item = std::move(q_.front());
q_.pop_front();
}
pop_cv_.notify_one();
return true;
}
#else
// apparently mingw deadlocks if the mutex is released before cv.notify_one(),
// so release the mutex at the very end each function.
// try to enqueue and block if no room left
void enqueue(T &&item)
{
std::unique_lock<std::mutex> lock(queue_mutex_);
pop_cv_.wait(lock, [this] { return !this->q_.full(); });
q_.push_back(std::move(item));
push_cv_.notify_one();
}
// enqueue immediately. overrun oldest message in the queue if no room left.
void enqueue_nowait(T &&item)
{
std::unique_lock<std::mutex> lock(queue_mutex_);
q_.push_back(std::move(item));
push_cv_.notify_one();
}
// try to dequeue item. if no item found. wait upto timeout and try again
// Return true, if succeeded dequeue item, false otherwise
bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration)
{
std::unique_lock<std::mutex> lock(queue_mutex_);
if (!push_cv_.wait_for(lock, wait_duration, [this] { return !this->q_.empty(); }))
{
return false;
}
popped_item = std::move(q_.front());
q_.pop_front();
pop_cv_.notify_one();
return true;
}
#endif
size_t overrun_counter()
{
std::unique_lock<std::mutex> lock(queue_mutex_);
return q_.overrun_counter();
}
size_t size()
{
std::unique_lock<std::mutex> lock(queue_mutex_);
return q_.size();
}
private:
std::mutex queue_mutex_;
std::condition_variable push_cv_;
std::condition_variable pop_cv_;
spdlog::details::circular_q<T> q_;
};
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/null_mutex.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include <atomic>
#include <utility>
// null, no cost dummy "mutex" and dummy "atomic" int
namespace spdlog {
namespace details {
struct null_mutex
{
void lock() const {}
void unlock() const {}
bool try_lock() const
{
return true;
}
};
struct null_atomic_int
{
int value;
null_atomic_int() = default;
explicit null_atomic_int(int new_value)
: value(new_value)
{}
int load(std::memory_order = std::memory_order_relaxed) const
{
return value;
}
void store(int new_value, std::memory_order = std::memory_order_relaxed)
{
value = new_value;
}
int exchange(int new_value, std::memory_order = std::memory_order_relaxed)
{
std::swap(new_value, value);
return new_value; // return value before the call
}
};
} // namespace details
} // namespace spdlog
================================================
FILE: vendor/spdlog/include/spdlog/details/os-inl.h
================================================
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#ifndef SPDLOG_HEADER_ONLY
#include <spdlog/details/os.h>
#endif
#include <spdlog/common.h>
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <string>
#include <thread>
#include <array>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef _WIN32
#include <io.h> // _get_osfhandle and _isatty support
#include <process.h> // _get_pid support
#include <spdlog/details/windows_include.h>
#ifdef __MINGW32__
#include <share.h>
#endif
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)
#include <limits>
#endif
#include <direct.h> // for _mkdir/_wmkdir
#else // unix
#include <fcntl.h>
#include <unistd.h>
#ifdef __linux__
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
#elif defined(_AIX)
#include <pthread.h> // for pthread_getthreadid_np
#elif defined(__DragonFly__) || defined(__FreeBSD__)
#include <pthread_np.h> // for pthread_getthreadid_np
#elif defined(__NetBSD__)
#include <lwp.h> // for _lwp_self
#elif defined(__sun)
#include <thread.h> // for thr_self
#endif
#endif // unix
#ifndef __has_feature // Clang - feature checking macros.
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
namespace spdlog {
namespace details {
namespace os {
SPDLOG_INLINE spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT
{
#if defined __linux__ && defined SPDLOG_CLOCK_COARSE
timespec ts;
::clock_gettime(CLOCK_REALTIME_COARSE, &ts);
return std::chrono::time_point<log_clock, typename log_clock::duration>(
std::chrono::duration_cast<typename log_clock::duration>(std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec)));
#else
return log_clock::now();
#endif
}
SPDLOG_INLINE std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
{
#ifdef _WIN32
std::tm tm;
::localtime_s(&tm, &time_tt);
#else
std::tm tm;
::localtime_r(&time_tt, &tm);
#endif
return tm;
}
SPDLOG_INLINE std::tm localtime() SPDLOG_NOEXCEPT
{
std::time_t now_t = ::time(nullptr);
return localtime(now_t);
}
SPDLOG_INLINE std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
{
#ifdef _WIN32
std::tm tm;
::gmtime_s(&tm, &time_tt);
#else
std::tm tm;
::gmtime_r(&time_tt, &tm);
#endif
return tm;
}
SPDLOG_INLINE std::tm gmtime() SPDLOG_NOEXCEPT
{
std::time_t now_t = ::time(nullptr);
return gmtime(now_t);
}
// fopen_s on non windows for writing
SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode)
{
#ifdef _WIN32
#ifdef SPDLOG_WCHAR_FILENAMES
*fp = ::_wfsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
#else
*fp = ::_fsopen((filename.c_str()), mode.c_str(), _SH_DENYNO);
#endif
#if defined(SPDLOG_PREVENT_CHILD_FD)
if (*fp != nullptr)
{
auto file_handle = reinterpret_cast<HANDLE>(_get_osfhandle(::_fileno(*fp)));
if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0))
{
::fclose(*fp);
*fp = nullptr;
}
}
#endif
#else // unix
#if defined(SPDLOG_PREVENT_CHILD_FD)
const int mode_flag = mode == SPDLOG_FILENAME_T("ab") ? O_APPEND : O_TRUNC;
const int fd = ::open((filename.c_str()), O_CREAT | O_WRONLY | O_CLOEXEC | mode_flag, mode_t(0644));
if (fd == -1)
{
return false;
}
*fp = ::fdopen(fd, mode.c_str());
if (*fp == nullptr)
{
::close(fd);
}
#else
*fp = ::fopen((filename.c_str()), mode.c_str());
#endif
#endif
return *fp == nullptr;
}
SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT
{
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
return ::_wremove(filename.c_str());
#else
return std::remove(filename.c_str());
#endif
}
SPDLOG_INLINE int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT
{
return path_exists(filename) ? remove(filename) : 0;
}
SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT
{
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
return ::_wrename(filename1.c_str(), filename2.c_str());
#else
return std::rename(filename1.c_str(), filename2.c_str());
#endif
}
// Return true if path exists (file or directory)
SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT
{
#ifdef _WIN32
#ifdef SPDLOG_WCHAR_FILENAMES
auto attribs = ::GetFileAttributesW(filename.c_str());
#else
auto attribs = ::GetFileAttributesA(filename.c_str());
#endif
return attribs != INVALID_FILE_ATTRIBUTES;
#else // common linux/unix all have the stat system call
struct stat buffer;
return (::stat(filename.c_str(), &buffer) == 0);
#endif
}
#ifdef _MSC_VER
// avoid warning about unreachable statement at the end of filesize()
#pragma warning(push)
#pragma warning(disable: 4702)
#endif
// Return file size according to open FILE* object
SPDLOG_INLINE size_t filesize(FILE *f)
{
if (f == nullptr)
{
throw_spdlog_ex("Failed getting file size. fd is null");
}
#if defined(_WIN32) && !defined(__CYGWIN__)
int fd = ::_fileno(f);
#if defined(_WIN64) // 64 bits
__int64 ret = ::_filelengthi64(fd);
if (ret >= 0)
{
return static_cast<size_t>(ret);
}
#else // windows 32 bits
long ret = ::_filelength(fd);
if (ret >= 0)
{
return static_cast<size_t>(ret);
}
#endif
#else // unix
// OpenBSD doesn't compile with :: before the fileno(..)
#if defined(__OpenBSD__)
int fd = fileno(f);
#else
int fd = ::fileno(f);
#endif
// 64 bits(but not in osx or cygwin, where fstat64 is deprecated)
#if (defined(__linux__) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64))
struct stat64 st;
if (::fstat64(fd, &st) == 0)
{
return static_cast<size_t>(st.st_size);
}
#else // other unix or linux 32 bits or cygwin
struct stat st;
if (::fstat(fd, &st) == 0)
{
return static_cast<size_t>(st.st_size);
}
#endif
#endif
throw_spdlog_ex("Failed getting file size from fd", errno);
return 0; // will not be reached.
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
// Return utc offset in minutes or throw spdlog_ex on failure
SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm)
{
#ifdef _WIN32
#if _WIN32_WINNT < _WIN32_WINNT_WS08
TIME_ZONE_INFORMATION tzinfo;
auto rv = ::GetTimeZoneInformation(&tzinfo);
#else
DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
auto rv = ::GetDynamicTimeZoneInformation(&tzinfo);
#endif
if (rv == TIME_ZONE_ID_INVALID)
throw_spdlog_ex("Failed getting timezone info. ", errno);
int offset = -tzinfo.Bias;
if (tm.tm_isdst)
{
offset -= tzinfo.DaylightBias;
}
else
{
offset -= tzinfo.StandardBias;
}
return offset;
#else
#if defined(sun) || defined(__sun) || defined(_AIX) || (!defined(_BSD_SOURCE) && !defined(_GNU_SOURCE))
// 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris
struct helper
{
static long int calculate_gmt_offset(const std::tm &localtm = details::os::localtime(), const std::tm &gmtm = details::os::gmtime())
{
int local_year = localtm.tm_year + (1900 - 1);
int gmt_year = gmtm.tm_year + (1900 - 1);
long int days = (
// difference in day of year
localtm.tm_yday -
gmtm.tm_yday
// + intervening leap days
+ ((local_year >> 2) - (gmt_year >> 2)) - (local_year / 100 - gmt_year / 100) +
((local_year / 100 >> 2) - (gmt_year / 100 >> 2))
// + difference in years * 365 */
+ (long int)(local_year - gmt_year) * 365);
long int hours = (24 * days) + (localtm.tm_hour - gmtm.tm_hour);
long int mins = (60 * hours) + (localtm.tm_min - gmtm.tm_min);
long int secs = (60 * mins) + (localtm.tm_sec - gmtm.tm_sec);
return secs;
}
};
auto offset_seconds = helper::calculate_gmt_offset(tm);
#else
auto offset_seconds = tm.tm_gmtoff;
#endif
return static_cast<int>(offset_seconds / 60);
#endif
}
// Return current thread id as size_t
// It exists because the std::this_thread::get_id() is much slower(especially
// under VS 2013)
SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
{
#ifdef _WIN32
return static_cast<size_t>(::GetCurrentThreadId());
#elif defined(__linux__)
#if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
#define SYS_gettid __NR_gettid
#endif
return static_cast<size_t>(::syscall(SYS_gettid));
#elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD__)
return static_cast<size_t>(::pthread_getthreadid_np());
#elif defined(__NetBSD__)
return static_cast<size_t>(::_lwp_self());
#elif defined(__OpenBSD__)
return static_cast<size_t>(::getthrid());
#elif defined(__sun)
return static_cast<size_t>(::thr_self());
#elif __APPLE__
uint64_t tid;
pthread_threadid_np(nullptr, &tid);
return static_cast<size_t>(tid);
#else // Default to standard C++11 (other Unix)
return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));
#endif
}
// Return current thread id as size_t (from thread local storage)
SPDLOG_INLINE size_t thread_id() SPDLOG_NOEXCEPT
{
#if defined(SPDLOG_NO_TLS)
return _thread_id();
#else // cache thread id in tls
static thread_local const size_t tid = _thread_id();
return tid;
#endif
}
// This is avoid msvc issue in sleep_for that happens if the clock changes.
// See https://github.com/gabime/spdlog/issues/609
SPDLOG_INLINE void sleep_for_millis(unsigned int milliseconds)
gitextract_6h2br1l5/
├── .gitignore
├── Main.cpp
├── README.md
├── VIFTools.cpp
├── VIFTools.hpp
├── VMPImportFixer.cpp
├── VMPImportFixer.hpp
├── VMPImportFixer.sln
├── VMPImportFixer.vcxproj
├── VMPImportFixer.vcxproj.filters
├── msc/
│ ├── Process.cpp
│ ├── Process.hpp
│ └── ScopedHandle.hpp
└── vendor/
├── pepp/
│ ├── ExportDirectory.cpp
│ ├── ExportDirectory.hpp
│ ├── FileHeader.hpp
│ ├── Image.cpp
│ ├── Image.hpp
│ ├── ImportDirectory.cpp
│ ├── ImportDirectory.hpp
│ ├── OptionalHeader.cpp
│ ├── OptionalHeader.hpp
│ ├── PEHeader.cpp
│ ├── PEHeader.hpp
│ ├── PELibrary.hpp
│ ├── PEUtil.cpp
│ ├── PEUtil.hpp
│ ├── RelocationDirectory.cpp
│ ├── RelocationDirectory.hpp
│ ├── SectionHeader.cpp
│ ├── SectionHeader.hpp
│ └── misc/
│ ├── Address.hpp
│ ├── ByteVector.hpp
│ ├── Concept.hpp
│ ├── File.cpp
│ ├── File.hpp
│ └── NonCopyable.hpp
├── spdlog/
│ ├── include/
│ │ └── spdlog/
│ │ ├── async.h
│ │ ├── async_logger-inl.h
│ │ ├── async_logger.h
│ │ ├── cfg/
│ │ │ ├── argv.h
│ │ │ ├── env.h
│ │ │ ├── helpers-inl.h
│ │ │ └── helpers.h
│ │ ├── common-inl.h
│ │ ├── common.h
│ │ ├── details/
│ │ │ ├── backtracer-inl.h
│ │ │ ├── backtracer.h
│ │ │ ├── circular_q.h
│ │ │ ├── console_globals.h
│ │ │ ├── file_helper-inl.h
│ │ │ ├── file_helper.h
│ │ │ ├── fmt_helper.h
│ │ │ ├── log_msg-inl.h
│ │ │ ├── log_msg.h
│ │ │ ├── log_msg_buffer-inl.h
│ │ │ ├── log_msg_buffer.h
│ │ │ ├── mpmc_blocking_q.h
│ │ │ ├── null_mutex.h
│ │ │ ├── os-inl.h
│ │ │ ├── os.h
│ │ │ ├── periodic_worker-inl.h
│ │ │ ├── periodic_worker.h
│ │ │ ├── registry-inl.h
│ │ │ ├── registry.h
│ │ │ ├── synchronous_factory.h
│ │ │ ├── tcp_client-windows.h
│ │ │ ├── tcp_client.h
│ │ │ ├── thread_pool-inl.h
│ │ │ ├── thread_pool.h
│ │ │ └── windows_include.h
│ │ ├── fmt/
│ │ │ ├── bin_to_hex.h
│ │ │ ├── bundled/
│ │ │ │ ├── args.h
│ │ │ │ ├── chrono.h
│ │ │ │ ├── color.h
│ │ │ │ ├── compile.h
│ │ │ │ ├── core.h
│ │ │ │ ├── format-inl.h
│ │ │ │ ├── format.h
│ │ │ │ ├── locale.h
│ │ │ │ ├── os.h
│ │ │ │ ├── ostream.h
│ │ │ │ ├── printf.h
│ │ │ │ ├── ranges.h
│ │ │ │ └── xchar.h
│ │ │ ├── chrono.h
│ │ │ ├── fmt.h
│ │ │ ├── ostr.h
│ │ │ └── xchar.h
│ │ ├── formatter.h
│ │ ├── fwd.h
│ │ ├── logger-inl.h
│ │ ├── logger.h
│ │ ├── pattern_formatter-inl.h
│ │ ├── pattern_formatter.h
│ │ ├── sinks/
│ │ │ ├── android_sink.h
│ │ │ ├── ansicolor_sink-inl.h
│ │ │ ├── ansicolor_sink.h
│ │ │ ├── base_sink-inl.h
│ │ │ ├── base_sink.h
│ │ │ ├── basic_file_sink-inl.h
│ │ │ ├── basic_file_sink.h
│ │ │ ├── daily_file_sink.h
│ │ │ ├── dist_sink.h
│ │ │ ├── dup_filter_sink.h
│ │ │ ├── hourly_file_sink.h
│ │ │ ├── mongo_sink.h
│ │ │ ├── msvc_sink.h
│ │ │ ├── null_sink.h
│ │ │ ├── ostream_sink.h
│ │ │ ├── ringbuffer_sink.h
│ │ │ ├── rotating_file_sink-inl.h
│ │ │ ├── rotating_file_sink.h
│ │ │ ├── sink-inl.h
│ │ │ ├── sink.h
│ │ │ ├── stdout_color_sinks-inl.h
│ │ │ ├── stdout_color_sinks.h
│ │ │ ├── stdout_sinks-inl.h
│ │ │ ├── stdout_sinks.h
│ │ │ ├── syslog_sink.h
│ │ │ ├── systemd_sink.h
│ │ │ ├── tcp_sink.h
│ │ │ ├── win_eventlog_sink.h
│ │ │ ├── wincolor_sink-inl.h
│ │ │ └── wincolor_sink.h
│ │ ├── spdlog-inl.h
│ │ ├── spdlog.h
│ │ ├── stopwatch.h
│ │ ├── tweakme.h
│ │ └── version.h
│ └── src/
│ ├── async.cpp
│ ├── cfg.cpp
│ ├── color_sinks.cpp
│ ├── file_sinks.cpp
│ ├── fmt.cpp
│ ├── spdlog.cpp
│ └── stdout_sinks.cpp
├── unicorn/
│ ├── include/
│ │ ├── list.h
│ │ ├── qemu.h
│ │ ├── uc_priv.h
│ │ └── unicorn/
│ │ ├── arm.h
│ │ ├── arm64.h
│ │ ├── m68k.h
│ │ ├── mips.h
│ │ ├── platform.h
│ │ ├── sparc.h
│ │ ├── unicorn.h
│ │ └── x86.h
│ └── lib/
│ └── x64/
│ └── unicorn_static.lib
├── zycore/
│ ├── include/
│ │ ├── Zycore/
│ │ │ ├── API/
│ │ │ │ ├── Memory.h
│ │ │ │ ├── Process.h
│ │ │ │ ├── Synchronization.h
│ │ │ │ ├── Terminal.h
│ │ │ │ └── Thread.h
│ │ │ ├── Allocator.h
│ │ │ ├── ArgParse.h
│ │ │ ├── Bitset.h
│ │ │ ├── Comparison.h
│ │ │ ├── Defines.h
│ │ │ ├── Format.h
│ │ │ ├── LibC.h
│ │ │ ├── List.h
│ │ │ ├── Object.h
│ │ │ ├── Status.h
│ │ │ ├── String.h
│ │ │ ├── Types.h
│ │ │ ├── Vector.h
│ │ │ ├── Zycore.h
│ │ │ └── ZycoreExportConfig.h
│ │ └── ZycoreExportConfig.h
│ └── src/
│ ├── API/
│ │ ├── Memory.c
│ │ ├── Process.c
│ │ ├── Synchronization.c
│ │ ├── Terminal.c
│ │ └── Thread.c
│ ├── Allocator.c
│ ├── ArgParse.c
│ ├── Bitset.c
│ ├── Format.c
│ ├── List.c
│ ├── String.c
│ ├── Vector.c
│ └── Zycore.c
└── zydis/
├── include/
│ ├── Zydis/
│ │ ├── Decoder.h
│ │ ├── DecoderTypes.h
│ │ ├── Formatter.h
│ │ ├── FormatterBuffer.h
│ │ ├── Generated/
│ │ │ ├── EnumISAExt.h
│ │ │ ├── EnumISASet.h
│ │ │ ├── EnumInstructionCategory.h
│ │ │ ├── EnumMnemonic.h
│ │ │ └── EnumRegister.h
│ │ ├── Internal/
│ │ │ ├── DecoderData.h
│ │ │ ├── FormatterATT.h
│ │ │ ├── FormatterBase.h
│ │ │ ├── FormatterIntel.h
│ │ │ ├── SharedData.h
│ │ │ └── String.h
│ │ ├── MetaInfo.h
│ │ ├── Mnemonic.h
│ │ ├── Register.h
│ │ ├── SharedTypes.h
│ │ ├── ShortString.h
│ │ ├── Status.h
│ │ ├── Utils.h
│ │ └── Zydis.h
│ └── ZydisExportConfig.h
├── lib/
│ ├── ReleaseX64/
│ │ ├── Zycore.lib
│ │ └── Zydis.lib
│ └── ReleaseX86/
│ ├── Zycore.lib
│ └── Zydis.lib
└── src/
├── Decoder.c
├── DecoderData.c
├── Formatter.c
├── FormatterATT.c
├── FormatterBase.c
├── FormatterBuffer.c
├── FormatterIntel.c
├── Generated/
│ ├── AccessedFlags.inc
│ ├── DecoderTables.inc
│ ├── EncodableInstructions.inc
│ ├── EnumISAExt.inc
│ ├── EnumISASet.inc
│ ├── EnumInstructionCategory.inc
│ ├── EnumMnemonic.inc
│ ├── EnumRegister.inc
│ ├── FormatterStrings.inc
│ ├── InstructionDefinitions.inc
│ ├── InstructionEncodings.inc
│ └── OperandDefinitions.inc
├── MetaInfo.c
├── Mnemonic.c
├── Register.c
├── SharedData.c
├── String.c
├── Utils.c
└── Zydis.c
SYMBOL INDEX (1248 symbols across 189 files)
FILE: Main.cpp
function IVMPImportFixer (line 6) | IVMPImportFixer* VifFactory_GenerateFixer(std::string_view vmpsn) noexcept
function main (line 11) | int main(int argc, const char** argv)
function IsFileArchX64 (line 143) | bool IsFileArchX64(std::filesystem::path path, bool* parsed)
FILE: VIFTools.cpp
function DWORD (line 3) | DWORD VifSearchForProcess(std::string_view process_name) noexcept
function VifFindModuleInProcess (line 25) | bool VifFindModuleInProcess(HANDLE hProc, std::string_view module_name, ...
function VifFindModulesInProcess (line 60) | bool VifFindModulesInProcess(HANDLE hProc, std::vector<VIFModuleInformat...
FILE: VIFTools.hpp
type VIFModuleInformation_t (line 3) | struct VIFModuleInformation_t
FILE: VMPImportFixer.cpp
class VMPImportFixer<32> (line 8) | class VMPImportFixer<32>
class VMPImportFixer<64> (line 9) | class VMPImportFixer<64>
class UnicornEngine (line 11) | class UnicornEngine
method UnicornEngine (line 15) | UnicornEngine(uc_engine* eng) noexcept
FILE: VMPImportFixer.hpp
class IVMPImportFixer (line 39) | class IVMPImportFixer
class VMPImportFixer (line 49) | class VMPImportFixer : public pepp::msc::NonCopyable, public IVMPImportF...
FILE: msc/Process.cpp
function ReadPage (line 30) | static bool ReadPage(HANDLE handle, LPVOID address, LPVOID buffer, std::...
FILE: msc/Process.hpp
type vif::nt (line 7) | namespace vif::nt
class Process (line 9) | class Process : pepp::msc::NonCopyable
method Process (line 12) | Process() = default;
method HANDLE (line 30) | HANDLE handle() noexcept { return m_handle.handle(); }
FILE: msc/ScopedHandle.hpp
type vif::nt (line 5) | namespace vif::nt
class ScopedHandle (line 7) | class ScopedHandle : pepp::msc::NonCopyable
method ScopedHandle (line 12) | ScopedHandle() = default;
method ScopedHandle (line 15) | ScopedHandle(HANDLE handle)
method HANDLE (line 31) | HANDLE handle() noexcept
method LPHANDLE (line 36) | LPHANDLE lphandle() noexcept
FILE: vendor/pepp/ExportDirectory.cpp
class ExportDirectory<32> (line 5) | class ExportDirectory<32>
class ExportDirectory<64> (line 6) | class ExportDirectory<64>
function ExportData_t (line 9) | ExportData_t ExportDirectory<bitsize>::GetExport(std::uint32_t idx, bool...
FILE: vendor/pepp/ExportDirectory.hpp
type pepp (line 5) | namespace pepp
type ExportData_t (line 7) | struct ExportData_t
class ExportDirectory (line 15) | class ExportDirectory : public pepp::msc::NonCopyable
method SetNumberOfFunctions (line 28) | void SetNumberOfFunctions(std::uint32_t num) {
method GetNumberOfFunctions (line 32) | std::uint32_t GetNumberOfFunctions() const {
method SetNumberOfNames (line 36) | void SetNumberOfNames(std::uint32_t num) {
method GetNumberOfNames (line 40) | std::uint32_t GetNumberOfNames() const {
method SetCharacteristics (line 44) | void SetCharacteristics(std::uint32_t chrs) {
method GetCharacteristics (line 48) | std::uint32_t GetCharacteristics() const {
method SetTimeDateStamp (line 52) | void SetTimeDateStamp(std::uint32_t TimeDateStamp) {
method GetTimeDateStamp (line 56) | std::uint32_t GetTimeDateStamp() const {
method SetAddressOfFunctions (line 60) | void SetAddressOfFunctions(std::uint32_t AddressOfFunctions) {
method GetAddressOfFunctions (line 64) | std::uint32_t GetAddressOfFunctions() const {
method SetAddressOfNames (line 68) | void SetAddressOfNames(std::uint32_t AddressOfNames) {
method GetAddressOfNames (line 72) | std::uint32_t GetAddressOfNames() const {
method SetAddressOfNameOrdinals (line 76) | void SetAddressOfNameOrdinals(std::uint32_t AddressOfNamesOrdinals) {
method GetAddressOfNameOrdinals (line 80) | std::uint32_t GetAddressOfNameOrdinals() const {
method size (line 85) | constexpr std::size_t size() const {
method _setup (line 91) | void _setup(Image<bitsize>* image) {
FILE: vendor/pepp/FileHeader.hpp
type pepp (line 3) | namespace pepp
type PEMachine (line 5) | enum class PEMachine
class FileHeader (line 12) | class FileHeader : pepp::msc::NonCopyable
method FileHeader (line 19) | FileHeader()
method SetMachine (line 23) | void SetMachine(PEMachine machine) {
method PEMachine (line 27) | PEMachine GetMachine() const {
method SetNumberOfSections (line 31) | void SetNumberOfSections(std::uint16_t numSections) {
method GetNumberOfSections (line 35) | std::uint16_t GetNumberOfSections() const {
method SetTimeDateStamp (line 39) | void SetTimeDateStamp(std::uint32_t dwTimeDateStamp) {
method GetTimeDateStamp (line 43) | std::uint32_t GetTimeDateStamp() const {
method SetPointerToSymbolTable (line 47) | void SetPointerToSymbolTable(std::uint32_t dwPointerToSymbolTable) {
method GetPointerToSymbolTable (line 51) | std::uint32_t GetPointerToSymbolTable() const {
method SetNumberOfSymbols (line 55) | void SetNumberOfSymbols(std::uint32_t numSymbols) {
method GetNumberOfSymbols (line 59) | std::uint32_t GetNumberOfSymbols() const {
method SetSizeOfOptionalHeader (line 63) | void SetSizeOfOptionalHeader(std::uint16_t size) {
method GetSizeOfOptionalHeader (line 67) | std::uint16_t GetSizeOfOptionalHeader() const {
method SetCharacteristics (line 71) | void SetCharacteristics(std::uint16_t chars) {
method GetCharacteristics (line 75) | std::uint16_t GetCharacteristics() const {
method IMAGE_FILE_HEADER (line 79) | IMAGE_FILE_HEADER* native() const {
method _setup (line 84) | void _setup(Image<bitsize>* image) {
FILE: vendor/pepp/Image.cpp
class Image<32> (line 8) | class Image<32>
class Image<64> (line 9) | class Image<64>
function PEMachine (line 30) | constexpr PEMachine Image<bitsize>::GetMachine() const
FILE: vendor/pepp/Image.hpp
type pepp (line 3) | namespace pepp
class PEHeader (line 6) | class PEHeader
class SectionHeader (line 7) | class SectionHeader
class ExportDirectory (line 9) | class ExportDirectory
class ImportDirectory (line 11) | class ImportDirectory
class RelocationDirectory (line 13) | class RelocationDirectory
type SectionCharacteristics (line 14) | enum SectionCharacteristics
type PEDirectoryEntry (line 15) | enum PEDirectoryEntry
type PEMachine (line 16) | enum class PEMachine
type detail (line 18) | namespace detail
type Image_t (line 21) | struct Image_t
type Image_t<64> (line 36) | struct Image_t<64>
type Image_t<32> (line 45) | struct Image_t<32>
class Image (line 60) | class Image : pepp::msc::NonCopyable
method magic (line 122) | std::uint16_t magic() const {
class PEHeader<bitsize> (line 127) | class PEHeader<bitsize>
class ExportDirectory<bitsize> (line 131) | class ExportDirectory<bitsize>
class ImportDirectory<bitsize> (line 135) | class ImportDirectory<bitsize>
class RelocationDirectory<bitsize> (line 139) | class RelocationDirectory<bitsize>
class ExportDirectory<bitsize> (line 147) | class ExportDirectory<bitsize>
class ImportDirectory<bitsize> (line 151) | class ImportDirectory<bitsize>
class RelocationDirectory<bitsize> (line 155) | class RelocationDirectory<bitsize>
method GetBitSize (line 175) | static constexpr unsigned int GetBitSize() { return bitsize; }
method SectionHeader (line 205) | SectionHeader& GetSectionHeader(std::uint16_t dwIndex) {
method SectionHeader (line 208) | SectionHeader& GetSectionHeader(std::string_view name) {
method SectionHeader (line 211) | SectionHeader& GetSectionHeaderFromVa(std::uint32_t va) {
method SectionHeader (line 214) | SectionHeader& GetSectionHeaderFromOffset(std::uint32_t offset) {
method GetNumberOfSections (line 217) | std::uint16_t GetNumberOfSections() const {
method GetWordSize (line 221) | constexpr auto GetWordSize() const {
FILE: vendor/pepp/ImportDirectory.cpp
class ImportDirectory<32> (line 7) | class ImportDirectory<32>
class ImportDirectory<64> (line 8) | class ImportDirectory<64>
FILE: vendor/pepp/ImportDirectory.hpp
type pepp (line 7) | namespace pepp
type ModuleImportData_t (line 9) | struct ModuleImportData_t
class ImportDirectory (line 23) | class ImportDirectory : pepp::msc::NonCopyable
method ImportDirectory (line 32) | ImportDirectory() = default;
method SetCharacteristics (line 40) | void SetCharacteristics(std::uint32_t chrs) {
method GetCharacteristics (line 44) | std::uint32_t GetCharacteristics() const {
method SetTimeDateStamp (line 48) | void SetTimeDateStamp(std::uint32_t TimeDateStamp) {
method GetTimeDateStamp (line 52) | std::uint32_t GetTimeDateStamp() const {
method IsImportOrdinal (line 58) | bool IsImportOrdinal(T ord) const requires pepp::msc::MemoryAddress<...
method _setup (line 68) | void _setup(Image<bitsize>* image) {
FILE: vendor/pepp/OptionalHeader.cpp
class OptionalHeader<32> (line 6) | class OptionalHeader<32>
class OptionalHeader<64> (line 7) | class OptionalHeader<64>
function PEMagic (line 21) | PEMagic OptionalHeader<bitsize>::GetMagic() const
FILE: vendor/pepp/OptionalHeader.hpp
type pepp (line 3) | namespace pepp
type PEDirectoryEntry (line 5) | enum PEDirectoryEntry
type PEMagic (line 24) | enum class PEMagic
class OptionalHeader (line 32) | class OptionalHeader : pepp::msc::NonCopyable
method DirectoryCount (line 89) | std::uint32_t DirectoryCount() const {
method _setup (line 108) | void _setup(Image<bitsize>* image) {
FILE: vendor/pepp/PEHeader.cpp
class PEHeader<32> (line 6) | class PEHeader<32>
class PEHeader<64> (line 7) | class PEHeader<64>
FILE: vendor/pepp/PEHeader.hpp
type pepp (line 3) | namespace pepp
class Image (line 8) | class Image
class OptionalHeader (line 10) | class OptionalHeader
class SectionHeader (line 12) | class SectionHeader
class FileHeader (line 13) | class FileHeader
class PEHeader (line 16) | class PEHeader : pepp::msc::NonCopyable
class FileHeader (line 31) | class FileHeader
class FileHeader (line 35) | class FileHeader
class OptionalHeader<bitsize> (line 39) | class OptionalHeader<bitsize>
class OptionalHeader<bitsize> (line 43) | class OptionalHeader<bitsize>
method SectionHeader (line 47) | SectionHeader& GetSectionHeader(std::uint16_t dwIndex) {
method SectionHeader (line 56) | SectionHeader& GetSectionHeader(std::string_view name) {
method SectionHeader (line 69) | SectionHeader& GetSectionHeaderFromVa(std::uint32_t va) {
method SectionHeader (line 82) | SectionHeader& GetSectionHeaderFromOffset(std::uint32_t offset) {
method DirectoryCount (line 98) | std::uint32_t DirectoryCount() const {
method RvaToOffset (line 103) | std::uint32_t RvaToOffset(std::uint32_t rva) {
method OffsetToRva (line 115) | std::uint32_t OffsetToRva(std::uint32_t offset) {
method RvaToVa (line 127) | detail::Image_t<bitsize>::Address_t RvaToVa(std::uint32_t rva) const {
method IsTaggedPE (line 132) | bool IsTaggedPE() const {
method size (line 140) | constexpr std::size_t size() const {
method _setup (line 162) | void _setup(Image<bitsize>* image) {
FILE: vendor/pepp/PEUtil.hpp
type pepp (line 4) | namespace pepp
function Align (line 11) | constexpr __forceinline auto Align(V_t value, std::uint32_t alignment)...
function Align4kb (line 20) | constexpr __forceinline auto Align4kb(V_t v) requires std::unsigned_in...
FILE: vendor/pepp/RelocationDirectory.cpp
class RelocationDirectory<32> (line 6) | class RelocationDirectory<32>
class RelocationDirectory<64> (line 7) | class RelocationDirectory<64>
function BlockStream (line 102) | BlockStream RelocationDirectory<bitsize>::CreateBlock(std::uint32_t rva,...
FILE: vendor/pepp/RelocationDirectory.hpp
type pepp (line 3) | namespace pepp
type RelocationType (line 13) | enum RelocationType : std::int8_t
function CraftRelocationBlockEntry (line 28) | constexpr std::uint16_t CraftRelocationBlockEntry(RelocationType type,...
class BlockEntry (line 32) | class BlockEntry
method BlockEntry (line 37) | BlockEntry(std::uint32_t va, std::uint16_t entry)
method RelocationType (line 43) | RelocationType GetType() const
method GetOffset (line 48) | std::uint32_t GetOffset() const
method GetRva (line 54) | std::uint32_t GetRva() const
class BlockStream (line 65) | class BlockStream
method BlockStream (line 71) | BlockStream(detail::Image_t<>::RelocationBase_t* reloc)
method Push (line 78) | void Push(RelocationType type, std::uint16_t offset)
class RelocationDirectory (line 88) | class RelocationDirectory : pepp::msc::NonCopyable
method IsPresent (line 107) | bool IsPresent() const {
method _setup (line 112) | void _setup(Image<bitsize>* image) {
FILE: vendor/pepp/SectionHeader.hpp
type pepp (line 3) | namespace pepp
class Image (line 6) | class Image
type SectionCharacteristics (line 8) | enum SectionCharacteristics : std::uint32_t
class SectionHeader (line 50) | class SectionHeader
method SectionHeader (line 57) | SectionHeader() {
method AddCharacteristic (line 106) | void AddCharacteristic(std::uint32_t dwChar) {
method StripCharacteristic (line 109) | void StripCharacteristic(std::uint32_t dwChar) {
method IsReadable (line 112) | bool IsReadable() const {
method IsWriteable (line 115) | bool IsWriteable() const {
method IsExecutable (line 118) | bool IsExecutable() const {
method HasVirtualAddress (line 121) | bool HasVirtualAddress(std::uint32_t va) const {
method HasOffset (line 124) | bool HasOffset(std::uint32_t offset) const {
FILE: vendor/pepp/misc/Address.hpp
type pepp (line 6) | namespace pepp {
class Address (line 8) | class Address
method Address (line 13) | constexpr Address(T value = 0) noexcept requires pepp::msc::MemoryA...
method Address (line 18) | constexpr Address(const Address& rhs) = default;
method Address (line 21) | Address& operator=(const Address& rhs) noexcept
method ValueType (line 32) | constexpr ValueType uintptr() const noexcept
method C (line 38) | C* as_ptr() noexcept requires pepp::msc::MemoryAddress<C*>
method C (line 44) | C as() noexcept
method C (line 50) | C& deref() noexcept
method Address (line 94) | constexpr Address operator+(const Address& rhs) const noexcept
method Address (line 99) | constexpr Address operator-(const Address& rhs) const noexcept
method Address (line 104) | constexpr Address operator*(const Address& rhs) const noexcept
method Address (line 109) | constexpr Address operator/(const Address& rhs) const noexcept
method Address (line 118) | constexpr Address& operator+=(const Address& rhs) noexcept
method Address (line 124) | constexpr Address& operator-=(const Address& rhs) noexcept
method Address (line 130) | constexpr Address& operator*=(const Address& rhs) noexcept
method Address (line 141) | constexpr Address operator>>(const Address& rhs) const noexcept
method Address (line 146) | constexpr Address operator<<(const Address& rhs) const noexcept
method Address (line 151) | constexpr Address operator^(const Address& rhs) const noexcept
method Address (line 156) | constexpr Address operator&(const Address& rhs) const noexcept
method Address (line 161) | constexpr Address operator|(const Address& rhs) const noexcept
method Address (line 170) | constexpr Address& operator>>=(const Address& rhs) noexcept
method Address (line 176) | constexpr Address& operator<<=(const Address& rhs) noexcept
method Address (line 182) | constexpr Address& operator^=(const Address& rhs) noexcept
method Address (line 188) | constexpr Address& operator&=(const Address& rhs) noexcept
method Address (line 194) | constexpr Address& operator|=(const Address& rhs) noexcept
FILE: vendor/pepp/misc/ByteVector.hpp
type pepp::mem (line 5) | namespace pepp::mem {
class ByteVector (line 6) | class ByteVector : public std::vector<std::uint8_t>
method ByteVector (line 13) | constexpr ByteVector& push_byte(std::uint8_t byte) {
method ByteVector (line 23) | constexpr ByteVector& push_raw(const T* data, std::size_t rsize) {
method ByteVector (line 34) | constexpr ByteVector& push_container(const T& container) {
method ByteVector (line 45) | constexpr ByteVector& push_array(const std::initializer_list<T>& lis...
method ByteVector (line 56) | constexpr ByteVector& push_range(iterator_t first, iterator_t last) {
method ByteVector (line 68) | constexpr ByteVector& push_args(std::convertible_to<std::uint8_t> au...
method ByteVector (line 78) | constexpr ByteVector& push_dword(std::uint32_t dword) {
method ByteVector (line 90) | constexpr ByteVector& push_qword(std::uint64_t qword) {
method ByteVector (line 107) | ByteVector& copy_data(std::size_t idx, const T* data, std::size_t rs...
method ByteVector (line 119) | ByteVector& insert_data(std::size_t idx, const T* data, std::size_t ...
method T (line 132) | T as(std::size_t idx = 0x0) const {
method T (line 136) | T as(std::size_t idx = 0x0) {
method T (line 145) | T deref(std::size_t idx = 0x0) const {
FILE: vendor/pepp/misc/Concept.hpp
type pepp::msc (line 5) | namespace pepp::msc
FILE: vendor/pepp/misc/File.cpp
type pepp::io (line 8) | namespace pepp::io {
function File (line 59) | File& io::File::operator=(File&& rhs)
FILE: vendor/pepp/misc/File.hpp
type pepp::io (line 5) | namespace pepp::io
type FileFlags (line 7) | enum FileFlags {
class File (line 15) | class File {
method File (line 17) | File() = default;
method File (line 18) | File(const File& other) = default;
FILE: vendor/pepp/misc/NonCopyable.hpp
type pepp::msc (line 3) | namespace pepp::msc
class NonCopyable (line 5) | class NonCopyable {
method NonCopyable (line 7) | NonCopyable() = default;
method NonCopyable (line 8) | NonCopyable(const NonCopyable&) = delete;
method NonCopyable (line 9) | NonCopyable& operator=(const NonCopyable&) = delete;
FILE: vendor/spdlog/include/spdlog/async.h
function namespace (line 25) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/async_logger-inl.h
function SPDLOG_INLINE (line 16) | SPDLOG_INLINE spdlog::async_logger::async_logger(
FILE: vendor/spdlog/include/spdlog/async_logger.h
type class (line 22) | enum class
function namespace (line 29) | namespace details {
FILE: vendor/spdlog/include/spdlog/cfg/argv.h
function namespace (line 20) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/cfg/env.h
function namespace (line 26) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/cfg/helpers-inl.h
function namespace (line 19) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/cfg/helpers.h
function namespace (line 9) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/common-inl.h
function namespace (line 13) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/common.h
function namespace (line 90) | namespace sinks {
function namespace (line 146) | namespace level {
type class (line 192) | enum class
type class (line 203) | enum class
type source_loc (line 226) | struct source_loc
function line (line 240) | int line{0}
function namespace (line 244) | namespace details {
FILE: vendor/spdlog/include/spdlog/details/backtracer-inl.h
function namespace (line 10) | namespace details {
FILE: vendor/spdlog/include/spdlog/details/backtracer.h
function namespace (line 16) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/circular_q.h
function namespace (line 10) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/console_globals.h
function namespace (line 9) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/file_helper-inl.h
function namespace (line 20) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/file_helper.h
function namespace (line 9) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/fmt_helper.h
function namespace (line 12) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/log_msg-inl.h
function namespace (line 12) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/log_msg.h
function namespace (line 9) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h
function SPDLOG_INLINE (line 13) | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg)
function SPDLOG_INLINE (line 21) | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
FILE: vendor/spdlog/include/spdlog/details/log_msg_buffer.h
function namespace (line 8) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/mpmc_blocking_q.h
function namespace (line 18) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/null_mutex.h
function namespace (line 10) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/os-inl.h
function namespace (line 67) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/periodic_worker-inl.h
function namespace (line 10) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/periodic_worker.h
function namespace (line 17) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/registry-inl.h
function namespace (line 30) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/registry.h
function namespace (line 20) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/synchronous_factory.h
function namespace (line 8) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/tcp_client-windows.h
function namespace (line 22) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/tcp_client.h
function namespace (line 22) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/thread_pool-inl.h
function namespace (line 13) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/details/thread_pool.h
type class (line 23) | enum class
type async_msg (line 33) | struct async_msg
function explicit (line 77) | explicit async_msg(async_msg_type the_type)
function class (line 82) | class SPDLOG_API thread_pool
FILE: vendor/spdlog/include/spdlog/fmt/bin_to_hex.h
function namespace (line 28) | namespace spdlog {
function namespace (line 78) | namespace fmt {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/args.h
function FMT_BEGIN_NAMESPACE (line 17) | FMT_BEGIN_NAMESPACE
function get_types (line 113) | unsigned long long get_types() const {
function pop_one (line 135) | auto pop_one = [](std::vector<basic_format_arg<Context>>* data) {
function clear (line 210) | void clear() {
function reserve (line 222) | void reserve(size_t new_cap, size_t new_cap_named) {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/chrono.h
function namespace (line 33) | namespace safe_duration_cast {
type Factor (line 223) | struct Factor
function min1 (line 253) | constexpr auto min1 = std::numeric_limits<IntermediateRep>::lowest() /
function namespace (line 284) | namespace detail {
function FMT_MODULE_EXPORT_BEGIN (line 361) | FMT_MODULE_EXPORT_BEGIN
function std (line 404) | inline std::tm localtime(
function std (line 414) | inline std::tm gmtime(std::time_t time) {
function std (line 449) | inline std::tm gmtime(
function FMT_BEGIN_DETAIL_NAMESPACE (line 454) | FMT_BEGIN_DETAIL_NAMESPACE
function strftime (line 466) | inline size_t strftime(wchar_t* str, size_t count, const wchar_t* format,
function numeric_system (line 576) | enum class numeric_system {
function handle_nan_inf (line 972) | bool handle_nan_inf() {
function Rep (line 991) | Rep hour12() const {
function write_sign (line 1007) | void write_sign() {
function write (line 1014) | void write(Rep value, int width) {
function write_nan (line 1024) | void write_nan() { std::copy_n("nan", 3, out); }
function write_pinf (line 1025) | void write_pinf() { std::copy_n("inf", 3, out); }
function write_ninf (line 1026) | void write_ninf() { std::copy_n("-inf", 4, out); }
function on_24_hour_time (line 1111) | void on_24_hour_time() {
function on_iso_time (line 1123) | void on_iso_time() {
function on_am_pm (line 1130) | void on_am_pm() {
function on_duration_value (line 1135) | void on_duration_value() {
function on_duration_unit (line 1141) | void on_duration_unit() {
function class (line 1152) | class weekday {
function weekday (line 1165) | struct formatter<weekday> {
type spec_handler (line 1200) | struct spec_handler {
function arg_ref_type (line 1210) | arg_ref_type make_arg_ref(basic_string_view<Char> arg_id) {
function on_error (line 1219) | void on_error(const char* msg) { FMT_THROW(format_error(msg)); }
function FMT_CONSTEXPR (line 1223) | FMT_CONSTEXPR void on_align(align_t align) { f.specs.align = align; }
function FMT_CONSTEXPR (line 1224) | FMT_CONSTEXPR void on_width(int width) { f.specs.width = width; }
function FMT_CONSTEXPR (line 1225) | FMT_CONSTEXPR void on_precision(int _precision) {
function FMT_CONSTEXPR (line 1228) | FMT_CONSTEXPR void end_precision() {}
function on_dynamic_width (line 1230) | void on_dynamic_width(Id arg_id) {
function on_dynamic_precision (line 1234) | void on_dynamic_precision(Id arg_id) {
type parse_range (line 1240) | struct parse_range {
function spec_handler (line 1248) | spec_handler handler{*this, ctx, format_str};
FILE: vendor/spdlog/include/spdlog/fmt/bundled/color.h
type class (line 23) | enum class
function terminal_color (line 167) | enum class terminal_color : uint8_t {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/compile.h
function FMT_BEGIN_NAMESPACE (line 13) | FMT_BEGIN_NAMESPACE
function counting_iterator (line 56) | counting_iterator copy_str(InputIt begin, InputIt end,
function operator (line 171) | constexpr operator basic_string_view<char_type>() const {
function Args (line 188) | [[maybe_unused]] const Args&... rest) {
function OutputIt (line 218) | OutputIt format(OutputIt out, const Args&...) const {
function OutputIt (line 237) | OutputIt format(OutputIt out, const Args&...) const {
function OutputIt (line 261) | OutputIt format(OutputIt out, const Args&... args) const {
function try_format_argument (line 275) | static bool try_format_argument(
function OutputIt (line 289) | OutputIt format(OutputIt out, const Args&... args) const {
function FMT_INLINE (line 307) | FMT_INLINE OutputIt format(OutputIt out,
function OutputIt (line 325) | OutputIt format(OutputIt out, const Args&... args) const {
type unknown_format (line 339) | struct unknown_format {}
function on_error (line 402) | constexpr void on_error(const char* message) { throw format_error(messag...
function FMT_INLINE (line 549) | FMT_INLINE OutputIt format_to(OutputIt out, const CompiledFormat& cf,
function OutputIt (line 582) | OutputIt format_to(OutputIt out, const S&, Args&&... args) {
function namespace (line 625) | inline namespace literals {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/core.h
function const_check (line 331) | struct monostate {
function T (line 388) | auto convert_for_visit(T value) -> T {
function int128_t (line 395) | enum class int128_t {}
function uint128_t (line 396) | enum class uint128_t {}
function FMT_END_DETAIL_NAMESPACE (line 420) | FMT_END_DETAIL_NAMESPACE
function size (line 474) | constexpr auto data() const -> const Char* { return data_; }
function operator (line 482) | constexpr auto operator[](size_t pos) const -> const Char& {
function FMT_CONSTEXPR (line 486) | FMT_CONSTEXPR void remove_prefix(size_t n) {
function FMT_CONSTEXPR_CHAR_TRAITS (line 492) | FMT_CONSTEXPR_CHAR_TRAITS auto compare(basic_string_view other) const ->...
function true_type (line 526) | struct is_char<char> : std::true_type {}
function Char (line 545) | auto to_string_view(const Char* s) -> basic_string_view<Char> {
function Char (line 550) | auto to_string_view(const std::basic_string<Char, Traits, Alloc>& s)
function Char (line 563) | auto to_string_view(detail::std_string_view<Char> s)
type compile_string (line 570) | struct compile_string {}
function check_format_string (line 601) | void check_format_string(const S&) {
type error_handler (line 611) | struct error_handler {
function FMT_CONSTEXPR (line 661) | FMT_CONSTEXPR void advance_to(iterator it) {
function FMT_CONSTEXPR (line 681) | FMT_CONSTEXPR void check_arg_id(int) {
function FMT_BEGIN_DETAIL_NAMESPACE (line 723) | FMT_BEGIN_DETAIL_NAMESPACE
function set (line 780) | void set(T* buf_data, size_t buf_capacity) FMT_NOEXCEPT {
function FMT_NOEXCEPT (line 798) | auto begin() const FMT_NOEXCEPT -> const T* { return ptr_; }
function data (line 808) | auto data() FMT_NOEXCEPT -> T* { return ptr_; }
function try_resize (line 818) | void try_resize(size_t count) {
function try_reserve (line 827) | void try_reserve(size_t new_capacity) {
function push_back (line 831) | void push_back(const T& value) {
function count (line 845) | struct buffer_traits {
function flush (line 879) | void flush() {
type view (line 982) | struct view {}
type arg_data (line 1010) | struct arg_data<T, Char, NUM_ARGS, 0> {
type is_named_arg (line 1025) | struct is_named_arg
type is_statically_named_arg (line 1026) | struct is_statically_named_arg
type is_named_arg (line 1029) | struct is_named_arg<named_arg<Char, T>> : std::true_type {}
function init_named_args (line 1047) | void init_named_args(std::nullptr_t, int, int,
function type (line 1059) | enum class type {
function long_type (line 1226) | auto map(long val) -> long_type { return val; }
function ulong_type (line 1227) | auto map(unsigned long val) -> ulong_type {
function FMT_CONSTEXPR (line 1235) | FMT_CONSTEXPR FMT_INLINE auto map(int128_t val) -> int128_t { return val; }
function FMT_CONSTEXPR (line 1236) | FMT_CONSTEXPR FMT_INLINE auto map(uint128_t val) -> uint128_t { return v...
function FMT_CONSTEXPR (line 1237) | FMT_CONSTEXPR FMT_INLINE auto map(bool val) -> bool { return val; }
function FMT_INLINE (line 1240) | FMT_INLINE auto map(T val) -> char_type {
function FMT_CONSTEXPR (line 1247) | FMT_CONSTEXPR FMT_INLINE auto map(float val) -> float { return val; }
function FMT_CONSTEXPR (line 1248) | FMT_CONSTEXPR FMT_INLINE auto map(double val) -> double { return val; }
function FMT_CONSTEXPR (line 1249) | FMT_CONSTEXPR FMT_INLINE auto map(long double val) -> long double {
function FMT_INLINE (line 1260) | FMT_INLINE auto map(const T& val)
function FMT_INLINE (line 1271) | FMT_INLINE auto map(const T& val)
function FMT_INLINE (line 1282) | FMT_INLINE auto map(const T& val)
function FMT_CONSTEXPR (line 1303) | FMT_CONSTEXPR FMT_INLINE auto map(void* val) -> const void* { return val; }
function FMT_CONSTEXPR (line 1304) | FMT_CONSTEXPR FMT_INLINE auto map(const void* val) -> const void* {
function void (line 1307) | auto map(std::nullptr_t val) -> const void* {
function FMT_INLINE (line 1332) | FMT_INLINE auto map(const T& val)
function FMT_INLINE (line 1341) | FMT_INLINE auto map(const T& val) -> const T& {
function FMT_INLINE (line 1346) | FMT_INLINE auto map(const T& named_arg)
function buffer (line 1374) | auto get_buffer(appender out) -> detail::buffer<char>& {
function base (line 1380) | appender(base it) : base(it) {}
function operator (line 1383) | auto operator++() -> appender& {
type detail (line 1417) | struct detail
function custom_ (line 1425) | custom_(custom) {}
function format (line 1427) | void format(typename Context::parse_context_type& parse_ctx,
function FMT_INLINE (line 1458) | FMT_INLINE auto visit_format_arg(
function class (line 1540) | class locale_ref {
function Context (line 1564) | auto make_arg(const T& value) -> basic_format_arg<Context> {
function FMT_INLINE (line 1576) | FMT_INLINE auto make_arg(const T& val) -> value<Context> {
function Context (line 1587) | auto make_arg(const T& value) -> basic_format_arg<Context> {
function FMT_CONSTEXPR (line 1622) | FMT_CONSTEXPR auto arg(basic_string_view<char_type> name) -> format_arg {
function FMT_CONSTEXPR (line 1625) | FMT_CONSTEXPR auto arg_id(basic_string_view<char_type> name) -> int {
function FMT_CONSTEXPR (line 1632) | FMT_CONSTEXPR auto error_handler() -> detail::error_handler { return {}; }
function FMT_CONSTEXPR (line 1643) | FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; }
function FMT_CONSTEXPR (line 1779) | FMT_CONSTEXPR auto type(int index) const -> detail::type {
function FMT_INLINE (line 1785) | constexpr FMT_INLINE basic_format_args(unsigned long long desc,
function namespace (line 1869) | namespace align {
function namespace (line 1873) | namespace sign {
type basic_format_specs (line 1908) | struct basic_format_specs {
function FMT_CONSTEXPR (line 2031) | FMT_CONSTEXPR void on_error(const char* message) {
function FMT_CONSTEXPR (line 2041) | FMT_CONSTEXPR auto make_arg_ref(int arg_id) -> arg_ref_type {
function FMT_CONSTEXPR (line 2050) | FMT_CONSTEXPR auto make_arg_ref(basic_string_view<char_type> arg_id)
function is_ascii_letter (line 2059) | bool is_ascii_letter(Char c) {
function Char (line 2065) | auto to_ascii(Char value) -> Char {
function is_name_start (line 2170) | bool is_name_start(Char c) {
type width_adapter (line 2217) | struct width_adapter {
function FMT_CONSTEXPR (line 2225) | FMT_CONSTEXPR void on_error(const char* message) {
type precision_adapter (line 2251) | struct precision_adapter {
function FMT_CONSTEXPR (line 2259) | FMT_CONSTEXPR void on_error(const char* message) {
function FMT_INLINE (line 2288) | FMT_INLINE auto parse_format_specs(const Char* begin,
function FMT_CONSTEXPR (line 2359) | FMT_CONSTEXPR void operator()() { arg_id = handler.on_arg_id(); }
function FMT_CONSTEXPR (line 2360) | FMT_CONSTEXPR void operator()(int id) { arg_id = handler.on_arg_id(id); }
function FMT_CONSTEXPR (line 2364) | FMT_CONSTEXPR void on_error(const char* message) {
function adapter (line 2376) | auto adapter = id_adapter{handler, 0};
function parse_format_string (line 2393) | void parse_format_string(
function FMT_CONSTEXPR (line 2476) | FMT_CONSTEXPR auto next_arg_id() -> int {
function check_int_type_spec (line 2490) | void check_int_type_spec(char spec, ErrorHandler&& eh) {
function float_format (line 2521) | enum class float_format : unsigned char {
function check_string_type_spec (line 2592) | void check_string_type_spec(Char spec, ErrorHandler&& eh) {
function check_pointer_type_spec (line 2597) | void check_pointer_type_spec(Char spec, ErrorHandler&& eh) {
function FMT_CONSTEXPR (line 2607) | FMT_CONSTEXPR void require_numeric_argument() {
function FMT_CONSTEXPR (line 2621) | FMT_CONSTEXPR void on_sign(sign_t s) {
function FMT_CONSTEXPR (line 2630) | FMT_CONSTEXPR void on_hash() {
function FMT_CONSTEXPR (line 2635) | FMT_CONSTEXPR void on_localized() {
function FMT_CONSTEXPR (line 2640) | FMT_CONSTEXPR void on_zero() {
function FMT_CONSTEXPR (line 2645) | FMT_CONSTEXPR void end_precision() {
function FMT_CONSTEXPR (line 2694) | FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
function FMT_CONSTEXPR (line 2697) | FMT_CONSTEXPR auto on_arg_id(int id) -> int {
function FMT_CONSTEXPR (line 2700) | FMT_CONSTEXPR auto on_arg_id(basic_string_view<Char> id) -> int {
function FMT_CONSTEXPR (line 2712) | FMT_CONSTEXPR void on_replacement_field(int, const Char*) {}
function FMT_CONSTEXPR (line 2721) | FMT_CONSTEXPR void on_error(const char* message) {
function vprint_mojibake (line 2745) | inline void vprint_mojibake(std::FILE*, string_view, format_args) {}
function str_ (line 2839) | basic_format_string(const S& s) : str_(s) {
function S (line 2863) | runtime(const S& s) -> basic_string_view<char_t<S>> {
function S (line 2870) | runtime(const S& s) -> basic_runtime<char_t<S>> {
function print (line 2993) | void print(std::FILE* f, format_string<T...> fmt, T&&... args) {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/format-inl.h
function FMT_BEGIN_NAMESPACE (line 31) | FMT_BEGIN_NAMESPACE
function FMT_FUNC (line 132) | FMT_FUNC std::system_error vsystem_error(int error_code, string_view for...
function namespace (line 138) | namespace detail {
type boundaries (line 169) | struct boundaries {
function class (line 175) | class fp {
function assign (line 233) | assign(Float) {
function multiply (line 258) | inline uint64_t multiply(uint64_t lhs, uint64_t rhs) {
function fp (line 275) | inline fp operator*(fp x, fp y) { return {multiply(x.f, y.f), x.e + y.e ...
function fp (line 279) | inline fp get_cached_power(int min_exponent, int& pow10_exponent) {
type accumulator (line 344) | struct accumulator {
function class (line 363) | class bigint {
function friend (line 481) | friend int compare(const bigint& lhs, const bigint& rhs) {
function friend (line 498) | friend int add_compare(const bigint& lhs1, const bigint& lhs2,
function assign_pow10 (line 522) | void assign_pow10(int exp) {
function square (line 541) | void square() {
function align (line 573) | void align(const bigint& other) {
function divmod_assign (line 586) | int divmod_assign(const bigint& divisor) {
function round_direction (line 600) | enum class round_direction { unknown, up, down };
type uint128_wrapper (line 779) | struct uint128_wrapper {
function namespace (line 827) | namespace dragonbox {
function FMT_FUNC (line 2528) | FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) {
function FMT_FUNC (line 2542) | FMT_FUNC void format_system_error(detail::buffer<char>& out, int error_c...
function FMT_FUNC (line 2557) | FMT_FUNC void report_system_error(int error_code,
function FMT_FUNC (line 2562) | FMT_FUNC std::string vformat(string_view fmt, format_args args) {
function namespace (line 2571) | namespace detail {
function namespace (line 2578) | namespace detail {
function FMT_FUNC (line 2598) | FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args a...
function FMT_FUNC (line 2615) | FMT_FUNC void vprint(string_view format_str, format_args args) {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/format.h
function FMT_BEGIN_NAMESPACE (line 81) | FMT_BEGIN_NAMESPACE
function FMT_BEGIN_NAMESPACE (line 174) | FMT_BEGIN_NAMESPACE
function FMT_BEGIN_NAMESPACE (line 247) | FMT_BEGIN_NAMESPACE
function FMT_INLINE (line 317) | FMT_INLINE void assume(bool condition) {
function Char (line 331) | auto get_data(std::basic_string<Char>& s) -> Char* {
type char8_type (line 425) | enum char8_type : unsigned char {}
function FMT_NOINLINE (line 429) | FMT_NOINLINE auto copy_str_noinline(InputIt begin, InputIt end,
function FMT_CONSTEXPR (line 451) | FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e)
function for_each_codepoint (line 484) | void for_each_codepoint(string_view s, F f) {
function FMT_CONSTEXPR (line 513) | FMT_CONSTEXPR inline size_t compute_width(string_view s) {
function FMT_MODULE_EXPORT_BEGIN (line 595) | FMT_MODULE_EXPORT_BEGIN
function resize (line 698) | void resize(size_t count) { this->try_resize(count); }
function reserve (line 701) | void reserve(size_t new_capacity) { this->try_reserve(new_capacity); }
function namespace (line 742) | namespace detail {
function FMT_API (line 748) | FMT_API format_error : public std::runtime_error {
function namespace (line 782) | namespace detail_exported {
function FMT_BEGIN_DETAIL_NAMESPACE (line 808) | FMT_BEGIN_DETAIL_NAMESPACE
function true_type (line 815) | struct is_integral<int128_t> : std::true_type {}
function true_type (line 816) | struct is_integral<uint128_t> : std::true_type {}
function basic_data (line 895) | struct data : basic_data<> {}
function FMT_CONSTEXPR (line 912) | FMT_CONSTEXPR inline auto count_digits(uint128_t n) -> int {
function FMT_CONSTEXPR20 (line 919) | FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int {
function FMT_INLINE (line 957) | FMT_INLINE uint64_t count_digits_inc(int n) {
function FMT_CONSTEXPR20 (line 978) | FMT_CONSTEXPR20 inline auto count_digits(uint32_t n) -> int {
function wchar_t (line 1011) | inline auto thousands_sep(locale_ref loc) -> thousands_sep_result<wchar_...
function Char (line 1017) | auto decimal_point(locale_ref loc) -> Char {
function wchar_t (line 1020) | inline auto decimal_point(locale_ref loc) -> wchar_t {
function FMT_INLINE (line 1037) | FMT_INLINE void copy2(char* dst, const char* src) { memcpy(dst, src, 2); }
function class (line 1138) | class utf8_to_utf16 {
function FMT_CONSTEXPR (line 1262) | FMT_CONSTEXPR auto fill(OutputIt it, size_t n,
function write (line 1317) | auto write = [=](reserve_iterator<OutputIt> it) {
function OutputIt (line 1336) | auto write(OutputIt out, Char value,
function FMT_CONSTEXPR (line 1350) | FMT_CONSTEXPR write_int_data(int num_digits, unsigned prefix,
function FMT_INLINE (line 1371) | FMT_INLINE auto write_int(OutputIt out, int num_digits,
function FMT_INLINE (line 1472) | FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
function FMT_INLINE (line 1545) | FMT_INLINE auto write(OutputIt out, T value,
type big_decimal_fp (line 1600) | struct big_decimal_fp {
function write (line 1702) | auto write = [=](iterator it) {
function fp (line 1810) | auto fp = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()),...
function OutputIt (line 1904) | auto write(OutputIt out, T value,
function FMT_INLINE (line 1985) | FMT_INLINE auto operator()(T value) -> iterator {
function const (line 1999) | void operator()(
function handler_ (line 2014) | handler_(eh) {}
function handler_ (line 2034) | handler_(eh) {}
function FMT_CONSTEXPR (line 2077) | FMT_CONSTEXPR auto get_arg(auto_id) -> format_arg {
function FMT_CONSTEXPR (line 2086) | FMT_CONSTEXPR auto get_arg(basic_string_view<Char> arg_id) -> format_arg {
function on_dynamic_width (line 2097) | void on_dynamic_width(Id arg_id) {
function on_dynamic_precision (line 2102) | void on_dynamic_precision(Id arg_id) {
function on_error (line 2107) | void on_error(const char* message) { context_.on_error(message); }
function value (line 2171) | statically_named_arg(const T& v) : value(v) {}
function FMT_API (line 2266) | FMT_API void report_system_error(int error_code,
function explicit (line 2294) | explicit format_int(long value) : str_(format_signed(value)) {}
function explicit (line 2295) | explicit format_int(long long value) : str_(format_signed(value)) {}
function explicit (line 2296) | explicit format_int(unsigned value) : str_(format_unsigned(value)) {}
function explicit (line 2297) | explicit format_int(unsigned long value) : str_(format_unsigned(value)) {}
function explicit (line 2298) | explicit format_int(unsigned long long value)
function data (line 2310) | auto data() const -> const char* { return str_; }
function error_handler (line 2404) | struct null_handler : detail::error_handler {
function class (line 2459) | class bytes {
function bytes (line 2468) | struct formatter<bytes> {
function T (line 2514) | auto map(const T& value) -> const T& {
function decltype (line 2518) | auto map(const T& value) -> decltype(mapper().map(value)) {
function string (line 2597) | auto to_string(const T& value) -> std::string {
function string (line 2604) | auto to_string(T value) -> std::string {
function FMT_BEGIN_DETAIL_NAMESPACE (line 2621) | FMT_BEGIN_DETAIL_NAMESPACE
function FMT_API (line 2715) | FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;
function string (line 2774) | auto vformat(const Locale& loc, string_view fmt, format_args args)
FILE: vendor/spdlog/include/spdlog/fmt/bundled/os.h
function Char (line 116) | const Char* c_str() const { return data_; }
function FMT_API (line 141) | FMT_API const std::error_category& system_category() FMT_NOEXCEPT;
function system_error (line 200) | system_error windows_error(int error_code, string_view message,
function std (line 210) | inline const std::error_category& system_category() FMT_NOEXCEPT {
function class (line 224) | class buffered_file {
function class (line 284) | class file {
function ostream_params (line 377) | struct ostream_params {
function flush (line 404) | void flush() {
function ostream (line 410) | void grow(size_t) override;
function close (line 432) | void close() {
function ostream (line 463) | ostream output_file(cstring_view path, T... params) {
function class (line 470) | class locale {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/ostream.h
function namespace (line 20) | namespace detail {
type converter (line 52) | struct converter {
function FMT_MODULE_EXPORT (line 154) | FMT_MODULE_EXPORT
FILE: vendor/spdlog/include/spdlog/fmt/bundled/printf.h
function advance_to (line 49) | void advance_to(OutputIt it) { out_ = it; }
function format_arg (line 53) | format_arg arg(int id) const { return args_.get(id); }
function FMT_CONSTEXPR (line 55) | FMT_CONSTEXPR void on_error(const char* message) {
function FMT_BEGIN_DETAIL_NAMESPACE (line 60) | FMT_BEGIN_DETAIL_NAMESPACE
type int_checker (line 72) | struct int_checker
function fits_in_int (line 73) | bool fits_in_int(T value) {
function fits_in_int (line 77) | static bool fits_in_int(int) { return true; }
function class (line 80) | class printf_precision_handler {
function class (line 97) | class is_zero_int {
function bool (line 112) | struct make_unsigned_or_bool<bool> { using type = bool; }
function arg_ (line 175) | arg_(arg) {}
function Char (line 190) | Char* operator()(T) { return nullptr; }
function Char (line 191) | const Char* operator()(const Char* s) { return s; }
function OutputIt (line 244) | OutputIt operator()(monostate value) { return base::operator()(value); }
function OutputIt (line 272) | OutputIt operator()(const char* value) {
function OutputIt (line 278) | OutputIt operator()(const wchar_t* value) {
function OutputIt (line 283) | OutputIt operator()(basic_string_view<Char> value) {
function OutputIt (line 288) | OutputIt operator()(const void* value) {
function OutputIt (line 293) | OutputIt operator()(typename basic_format_arg<context_type>::handle hand...
function get_arg (line 377) | auto get_arg = [&](int arg_index) {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/ranges.h
function namespace (line 47) | namespace detail {
FILE: vendor/spdlog/include/spdlog/fmt/bundled/xchar.h
function FMT_BEGIN_NAMESPACE (line 16) | FMT_BEGIN_NAMESPACE
function true_type (line 38) | struct is_char<wchar_t> : std::true_type {}
function true_type (line 39) | struct is_char<detail::char8_type> : std::true_type {}
function true_type (line 40) | struct is_char<char16_t> : std::true_type {}
function true_type (line 41) | struct is_char<char32_t> : std::true_type {}
function namespace (line 49) | inline namespace literals {
function vprint (line 206) | inline void vprint(std::FILE* f, wstring_view fmt, wformat_args args) {
function vprint (line 214) | inline void vprint(wstring_view fmt, wformat_args args) {
function wstring (line 230) | auto to_wstring(const T& value) -> std::wstring {
FILE: vendor/spdlog/include/spdlog/formatter.h
function namespace (line 9) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/fwd.h
function namespace (line 6) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/logger-inl.h
function namespace (line 16) | namespace spdlog {
function SPDLOG_INLINE (line 146) | SPDLOG_INLINE std::vector<sink_ptr> &logger::sinks()
function SPDLOG_INLINE (line 158) | SPDLOG_INLINE std::shared_ptr<logger> logger::clone(std::string logger_n...
FILE: vendor/spdlog/include/spdlog/logger.h
function namespace (line 43) | namespace spdlog {
function log (line 162) | void log(source_loc loc, level::level_enum lvl, string_view_t msg)
function log (line 175) | void log(level::level_enum lvl, string_view_t msg)
function should_log (line 278) | bool should_log(level::level_enum msg_level) const
function std (line 293) | const std::string &name() const;
FILE: vendor/spdlog/include/spdlog/pattern_formatter-inl.h
function class (line 37) | class scoped_padder
function name_formatter (line 107) | name_formatter final : public flag_formatter
function level_formatter (line 123) | level_formatter final : public flag_formatter
function format (line 147) | void format(const details::log_msg &msg, const std::tm &, memory_buf_t &...
function to12h (line 164) | static int to12h(const tm &t)
function std (line 170) | static std::array<const char *, 7> days{{"Sun", "Mon", "Tue", "Wed", "Th...
function format (line 180) | void format(const details::log_msg &, const std::tm &tm_time, memory_buf...
function std (line 189) | static std::array<const char *, 7> full_days{{"Sunday", "Monday", "Tuesd...
function format (line 199) | void format(const details::log_msg &, const std::tm &tm_time, memory_buf...
function b_formatter (line 211) | b_formatter final : public flag_formatter
function SPDLOG_INLINE (line 1073) | SPDLOG_INLINE std::tm pattern_formatter::get_time_(const details::log_ms...
function handle_flag_ (line 1083) | void pattern_formatter::handle_flag_(char flag, details::padding_info pa...
FILE: vendor/spdlog/include/spdlog/pattern_formatter.h
function namespace (line 19) | namespace spdlog {
function class (line 50) | class SPDLOG_API flag_formatter
function set_padding_info (line 71) | void set_padding_info(details::padding_info padding)
function pattern_formatter (line 77) | pattern_formatter final : public formatter
FILE: vendor/spdlog/include/spdlog/sinks/android_sink.h
function namespace (line 24) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h
function namespace (line 13) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/ansicolor_sink.h
function namespace (line 14) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/base_sink-inl.h
function SPDLOG_INLINE (line 26) | SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::log(const details::log_ms...
function SPDLOG_INLINE (line 33) | SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::flush()
function SPDLOG_INLINE (line 40) | SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::set_pattern(const std::st...
function SPDLOG_INLINE (line 47) | SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::set_formatter(std::unique...
function SPDLOG_INLINE (line 54) | SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::set_pattern_(const std::s...
function SPDLOG_INLINE (line 60) | SPDLOG_INLINE spdlog::sinks::base_sink<Mutex>::set_formatter_(std::uniqu...
FILE: vendor/spdlog/include/spdlog/sinks/base_sink.h
function namespace (line 16) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/basic_file_sink-inl.h
function namespace (line 13) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/basic_file_sink.h
function namespace (line 14) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/daily_file_sink.h
function namespace (line 22) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/dist_sink.h
function namespace (line 19) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/dup_filter_sink.h
function namespace (line 37) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/hourly_file_sink.h
function namespace (line 21) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/mongo_sink.h
function namespace (line 26) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/msvc_sink.h
function namespace (line 18) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/null_sink.h
function namespace (line 12) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/ostream_sink.h
function namespace (line 12) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/ringbuffer_sink.h
function namespace (line 15) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/rotating_file_sink-inl.h
function namespace (line 23) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/rotating_file_sink.h
function namespace (line 15) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/sink.h
function namespace (line 9) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h
function namespace (line 13) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/stdout_color_sinks.h
function namespace (line 14) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/stdout_sinks-inl.h
function namespace (line 27) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/stdout_sinks.h
function namespace (line 15) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/syslog_sink.h
function namespace (line 14) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/systemd_sink.h
function namespace (line 16) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/tcp_sink.h
function namespace (line 27) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/win_eventlog_sink.h
function namespace (line 43) | namespace spdlog {
function get_event_category (line 156) | struct eventlog
function HANDLE (line 202) | HANDLE event_log_handle()
function flush_ (line 245) | void flush_() override {}
FILE: vendor/spdlog/include/spdlog/sinks/wincolor_sink-inl.h
function namespace (line 16) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/sinks/wincolor_sink.h
function namespace (line 17) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/spdlog-inl.h
function namespace (line 13) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/spdlog.h
function namespace (line 23) | namespace spdlog {
FILE: vendor/spdlog/include/spdlog/stopwatch.h
function namespace (line 27) | namespace spdlog {
function namespace (line 51) | namespace fmt {
FILE: vendor/spdlog/src/async.cpp
class SPDLOG_API (line 13) | class SPDLOG_API
FILE: vendor/spdlog/src/color_sinks.cpp
class SPDLOG_API (line 17) | class SPDLOG_API
class SPDLOG_API (line 18) | class SPDLOG_API
class SPDLOG_API (line 19) | class SPDLOG_API
class SPDLOG_API (line 20) | class SPDLOG_API
class SPDLOG_API (line 21) | class SPDLOG_API
class SPDLOG_API (line 22) | class SPDLOG_API
class SPDLOG_API (line 25) | class SPDLOG_API
class SPDLOG_API (line 26) | class SPDLOG_API
class SPDLOG_API (line 27) | class SPDLOG_API
class SPDLOG_API (line 28) | class SPDLOG_API
class SPDLOG_API (line 29) | class SPDLOG_API
class SPDLOG_API (line 30) | class SPDLOG_API
FILE: vendor/spdlog/src/file_sinks.cpp
class SPDLOG_API (line 15) | class SPDLOG_API
class SPDLOG_API (line 16) | class SPDLOG_API
class SPDLOG_API (line 19) | class SPDLOG_API
class SPDLOG_API (line 20) | class SPDLOG_API
FILE: vendor/spdlog/src/fmt.cpp
function FMT_BEGIN_NAMESPACE (line 14) | FMT_BEGIN_NAMESPACE
type detail::basic_data<void> (line 63) | struct detail::basic_data<void>
FILE: vendor/spdlog/src/spdlog.cpp
class SPDLOG_API (line 25) | class SPDLOG_API
class SPDLOG_API (line 26) | class SPDLOG_API
FILE: vendor/spdlog/src/stdout_sinks.cpp
class SPDLOG_API (line 14) | class SPDLOG_API
class SPDLOG_API (line 15) | class SPDLOG_API
class SPDLOG_API (line 16) | class SPDLOG_API
class SPDLOG_API (line 17) | class SPDLOG_API
class SPDLOG_API (line 18) | class SPDLOG_API
class SPDLOG_API (line 19) | class SPDLOG_API
FILE: vendor/unicorn/include/list.h
type list_item (line 6) | struct list_item {
type list (line 11) | struct list {
type list (line 16) | struct list
type list (line 19) | struct list
type list (line 22) | struct list
type list (line 25) | struct list
type list (line 28) | struct list
type list (line 31) | struct list
FILE: vendor/unicorn/include/qemu.h
type uc_struct (line 6) | struct uc_struct
type RAMBlock (line 22) | typedef struct RAMBlock {
type BounceBuffer (line 36) | typedef struct {
type RAMList (line 43) | typedef struct RAMList {
FILE: vendor/unicorn/include/uc_priv.h
type ModuleEntry (line 37) | typedef struct ModuleEntry {
type ModuleTypeList (line 43) | typedef QTAILQ_HEAD(, ModuleEntry) ModuleTypeList;
type uc_err (line 45) | typedef uc_err (*query_t)(struct uc_struct *uc, uc_query_type type, size...
type uc_struct (line 48) | struct uc_struct
type uc_struct (line 49) | struct uc_struct
type uc_struct (line 51) | struct uc_struct
type uc_struct (line 59) | struct uc_struct
type uc_struct (line 60) | struct uc_struct
type uc_struct (line 62) | struct uc_struct
type uc_struct (line 64) | struct uc_struct
type uc_struct (line 66) | struct uc_struct
type MemoryRegion (line 68) | typedef MemoryRegion* (*uc_args_uc_ram_size_t)(struct uc_struct*, hwadd...
type MemoryRegion (line 70) | typedef MemoryRegion* (*uc_args_uc_ram_size_ptr_t)(struct uc_struct*, h...
type uc_struct (line 72) | struct uc_struct
type hook (line 85) | struct hook {
type uc_hook_idx (line 97) | enum uc_hook_idx {
function _hook_exists_bounded (line 135) | static inline bool _hook_exists_bounded(struct list_item *cur, uint64_t ...
type uc_struct (line 148) | struct uc_struct {
type uc_context (line 259) | struct uc_context {
type uc_struct (line 267) | struct uc_struct
FILE: vendor/unicorn/include/unicorn/arm.h
type uc_arm_reg (line 19) | typedef enum uc_arm_reg {
FILE: vendor/unicorn/include/unicorn/arm64.h
type uc_arm64_reg (line 19) | typedef enum uc_arm64_reg {
FILE: vendor/unicorn/include/unicorn/m68k.h
type uc_m68k_reg (line 19) | typedef enum uc_m68k_reg {
FILE: vendor/unicorn/include/unicorn/mips.h
type UC_MIPS_REG (line 23) | typedef enum UC_MIPS_REG {
FILE: vendor/unicorn/include/unicorn/platform.h
type int_fast8_t (line 67) | typedef signed char int_fast8_t;
type int_fast16_t (line 68) | typedef int int_fast16_t;
type int_fast32_t (line 69) | typedef int int_fast32_t;
type int_fast64_t (line 70) | typedef long long int_fast64_t;
type uint_fast8_t (line 71) | typedef unsigned char uint_fast8_t;
type uint_fast16_t (line 72) | typedef unsigned int uint_fast16_t;
type uint_fast32_t (line 73) | typedef unsigned int uint_fast32_t;
type uint_fast64_t (line 74) | typedef unsigned long long uint_fast64_t;
type _W64 (line 89) | typedef _W64 int intptr_t;
function gettimeofday (line 207) | static int gettimeofday(struct timeval* t, void* timezone)
function usleep (line 222) | static int usleep(uint32_t usec)
FILE: vendor/unicorn/include/unicorn/sparc.h
type uc_sparc_reg (line 23) | typedef enum uc_sparc_reg {
FILE: vendor/unicorn/include/unicorn/unicorn.h
type uc_struct (line 24) | struct uc_struct
type uc_engine (line 25) | typedef struct uc_struct uc_engine;
type uc_hook (line 27) | typedef size_t uc_hook;
type uc_arch (line 90) | typedef enum uc_arch {
type uc_mode (line 102) | typedef enum uc_mode {
type uc_err (line 147) | typedef enum uc_err {
type uc_mem_type (line 218) | typedef enum uc_mem_type {
type uc_hook_type (line 232) | typedef enum uc_hook_type {
type uc_mem_region (line 325) | typedef struct uc_mem_region {
type uc_query_type (line 332) | typedef enum uc_query_type {
type uc_context (line 341) | struct uc_context
type uc_context (line 342) | typedef struct uc_context uc_context;
type uc_prot (line 598) | typedef enum uc_prot {
FILE: vendor/unicorn/include/unicorn/x86.h
type uc_x86_mmr (line 18) | typedef struct uc_x86_mmr {
type uc_x86_msr (line 27) | typedef struct uc_x86_msr {
type uc_struct (line 34) | struct uc_struct
type uc_x86_reg (line 37) | typedef enum uc_x86_reg {
type uc_x86_insn (line 98) | typedef enum uc_x86_insn {
FILE: vendor/zycore/include/Zycore/API/Memory.h
type ZyanMemoryPageProtection (line 55) | typedef enum ZyanMemoryPageProtection_
FILE: vendor/zycore/include/Zycore/API/Synchronization.h
type pthread_mutex_t (line 57) | typedef pthread_mutex_t ZyanCriticalSection;
type CRITICAL_SECTION (line 69) | typedef CRITICAL_SECTION ZyanCriticalSection;
FILE: vendor/zycore/include/Zycore/API/Terminal.h
type ZyanStandardStream (line 110) | typedef enum ZyanStandardStream_
FILE: vendor/zycore/include/Zycore/API/Thread.h
type pthread_t (line 60) | typedef pthread_t ZyanThread;
type ZyanU64 (line 65) | typedef ZyanU64 ZyanThreadId;
type pthread_key_t (line 74) | typedef pthread_key_t ZyanThreadTlsIndex;
type HANDLE (line 104) | typedef HANDLE ZyanThread;
type DWORD (line 109) | typedef DWORD ZyanThreadId;
type DWORD (line 118) | typedef DWORD ZyanThreadTlsIndex;
type PFLS_CALLBACK_FUNCTION (line 123) | typedef PFLS_CALLBACK_FUNCTION ZyanThreadTlsCallback;
FILE: vendor/zycore/include/Zycore/Allocator.h
type ZyanAllocator_ (line 47) | struct ZyanAllocator_
type ZyanStatus (line 65) | typedef ZyanStatus (*ZyanAllocatorAllocate)(struct ZyanAllocator_* alloc...
type ZyanStatus (line 78) | typedef ZyanStatus (*ZyanAllocatorDeallocate)(struct ZyanAllocator_* all...
type ZyanAllocator (line 89) | typedef struct ZyanAllocator_
FILE: vendor/zycore/include/Zycore/ArgParse.h
type ZyanArgParseDefinition (line 51) | typedef struct ZyanArgParseDefinition_
type ZyanArgParseConfig (line 73) | typedef struct ZyanArgParseConfig_
type ZyanArgParseArg (line 104) | typedef struct ZyanArgParseArg_
FILE: vendor/zycore/include/Zycore/Bitset.h
type ZyanBitset (line 55) | typedef struct ZyanBitset_
type ZyanStatus (line 78) | typedef ZyanStatus (*ZyanBitsetByteOperation)(ZyanU8* v1, const ZyanU8* ...
FILE: vendor/zycore/include/Zycore/Comparison.h
type ZyanBool (line 55) | typedef ZyanBool (*ZyanEqualityComparison)(const void* left, const void*...
type ZyanI32 (line 68) | typedef ZyanI32 (*ZyanComparison)(const void* left, const void* right);
FILE: vendor/zycore/include/Zycore/Format.h
function ZYAN_INLINE (line 60) | ZYAN_INLINE ZyanU64 ZyanAbsI64(ZyanI64 x)
FILE: vendor/zycore/include/Zycore/LibC.h
type va_list (line 63) | typedef va_list ZyanVAList;
type FILE (line 89) | typedef FILE ZyanFile;
type __builtin_va_list (line 170) | typedef __builtin_va_list ZyanVAList;
function ZYAN_INLINE (line 233) | ZYAN_INLINE void* ZYAN_MEMCHR(const void* str, int c, ZyanUSize n)
function ZYAN_INLINE (line 249) | ZYAN_INLINE int ZYAN_MEMCMP(const void* s1, const void* s2, ZyanUSize n)
function ZYAN_INLINE (line 263) | ZYAN_INLINE void* ZYAN_MEMCPY(void* dst, const void* src, ZyanUSize n)
function ZYAN_INLINE (line 274) | ZYAN_INLINE void* ZYAN_MEMMOVE(void* dst, const void* src, ZyanUSize n)
function ZYAN_INLINE (line 294) | ZYAN_INLINE void* ZYAN_MEMSET(void* dst, int val, ZyanUSize n)
function ZYAN_INLINE (line 304) | ZYAN_INLINE char* ZYAN_STRCAT(char* dest, const char* src)
function ZYAN_INLINE (line 315) | ZYAN_INLINE char* ZYAN_STRCHR(const char* s, int c)
function ZYAN_INLINE (line 327) | ZYAN_INLINE int ZYAN_STRCMP(const char* s1, const char* s2)
function ZYAN_INLINE (line 336) | ZYAN_INLINE int ZYAN_STRCOLL(const char *s1, const char *s2)
function ZYAN_INLINE (line 346) | ZYAN_INLINE char* ZYAN_STRCPY(char* dest, const char* src)
function ZYAN_INLINE (line 353) | ZYAN_INLINE ZyanUSize ZYAN_STRCSPN(const char *s1, const char *s2)
function ZYAN_INLINE (line 367) | ZYAN_INLINE ZyanUSize ZYAN_STRLEN(const char* str)
function ZYAN_INLINE (line 377) | ZYAN_INLINE char* ZYAN_STRNCAT(char* dest, const char* src, ZyanUSize n)
function ZYAN_INLINE (line 395) | ZYAN_INLINE int ZYAN_STRNCMP(const char* s1, const char* s2, ZyanUSize n)
function ZYAN_INLINE (line 407) | ZYAN_INLINE char* ZYAN_STRNCPY(char* dest, const char* src, ZyanUSize n)
function ZYAN_INLINE (line 424) | ZYAN_INLINE char* ZYAN_STRPBRK(const char* s1, const char* s2)
function ZYAN_INLINE (line 436) | ZYAN_INLINE char* ZYAN_STRRCHR(const char* s, int c)
function ZYAN_INLINE (line 449) | ZYAN_INLINE ZyanUSize ZYAN_STRSPN(const char* s1, const char* s2)
function ZYAN_INLINE (line 459) | ZYAN_INLINE char* ZYAN_STRSTR(const char* s1, const char* s2)
function ZYAN_INLINE (line 472) | ZYAN_INLINE char* ZYAN_STRTOK(char* str, const char* delim)
function ZYAN_INLINE (line 493) | ZYAN_INLINE ZyanUSize ZYAN_STRXFRM(char* dest, const char* src, ZyanUSiz...
FILE: vendor/zycore/include/Zycore/List.h
type ZyanListNode (line 55) | typedef struct ZyanListNode_
type ZyanList (line 73) | typedef struct ZyanList_
FILE: vendor/zycore/include/Zycore/Object.h
type ZyanStatus (line 67) | typedef ZyanStatus (*ZyanMemberFunction)(void* object);
type ZyanStatus (line 76) | typedef ZyanStatus (*ZyanConstMemberFunction)(const void* object);
FILE: vendor/zycore/include/Zycore/Status.h
type ZyanU32 (line 48) | typedef ZyanU32 ZyanStatus;
FILE: vendor/zycore/include/Zycore/String.h
type ZyanU8 (line 76) | typedef ZyanU8 ZyanStringFlags;
type ZyanString (line 98) | typedef struct ZyanString_
type ZyanStringView (line 132) | typedef struct ZyanStringView_
FILE: vendor/zycore/include/Zycore/Types.h
type ZyanU8 (line 45) | typedef unsigned __int8 ZyanU8;
type ZyanU16 (line 46) | typedef unsigned __int16 ZyanU16;
type ZyanU32 (line 47) | typedef unsigned __int32 ZyanU32;
type ZyanU64 (line 48) | typedef unsigned __int64 ZyanU64;
type ZyanI8 (line 49) | typedef signed __int8 ZyanI8;
type ZyanI16 (line 50) | typedef signed __int16 ZyanI16;
type ZyanI32 (line 51) | typedef signed __int32 ZyanI32;
type ZyanI64 (line 52) | typedef signed __int64 ZyanI64;
type ZyanU64 (line 54) | typedef ZyanU64 ZyanUSize;
type ZyanI64 (line 55) | typedef ZyanI64 ZyanISize;
type ZyanU64 (line 56) | typedef ZyanU64 ZyanUPointer;
type ZyanI64 (line 57) | typedef ZyanI64 ZyanIPointer;
type ZyanU32 (line 59) | typedef ZyanU32 ZyanUSize;
type ZyanI32 (line 60) | typedef ZyanI32 ZyanISize;
type ZyanU32 (line 61) | typedef ZyanU32 ZyanUPointer;
type ZyanI32 (line 62) | typedef ZyanI32 ZyanIPointer;
type __UINT8_TYPE__ (line 65) | typedef __UINT8_TYPE__ ZyanU8;
type __UINT16_TYPE__ (line 66) | typedef __UINT16_TYPE__ ZyanU16;
type __UINT32_TYPE__ (line 67) | typedef __UINT32_TYPE__ ZyanU32;
type __UINT64_TYPE__ (line 68) | typedef __UINT64_TYPE__ ZyanU64;
type __INT8_TYPE__ (line 69) | typedef __INT8_TYPE__ ZyanI8;
type __INT16_TYPE__ (line 70) | typedef __INT16_TYPE__ ZyanI16;
type __INT32_TYPE__ (line 71) | typedef __INT32_TYPE__ ZyanI32;
type __INT64_TYPE__ (line 72) | typedef __INT64_TYPE__ ZyanI64;
type __SIZE_TYPE__ (line 73) | typedef __SIZE_TYPE__ ZyanUSize;
type __PTRDIFF_TYPE__ (line 74) | typedef __PTRDIFF_TYPE__ ZyanISize;
type __UINTPTR_TYPE__ (line 75) | typedef __UINTPTR_TYPE__ ZyanUPointer;
type __INTPTR_TYPE__ (line 76) | typedef __INTPTR_TYPE__ ZyanIPointer;
type ZyanU8 (line 84) | typedef uint8_t ZyanU8;
type ZyanU16 (line 85) | typedef uint16_t ZyanU16;
type ZyanU32 (line 86) | typedef uint32_t ZyanU32;
type ZyanU64 (line 87) | typedef uint64_t ZyanU64;
type ZyanI8 (line 88) | typedef int8_t ZyanI8;
type ZyanI16 (line 89) | typedef int16_t ZyanI16;
type ZyanI32 (line 90) | typedef int32_t ZyanI32;
type ZyanI64 (line 91) | typedef int64_t ZyanI64;
type ZyanUSize (line 92) | typedef size_t ZyanUSize;
type ZyanISize (line 93) | typedef ptrdiff_t ZyanISize;
type ZyanUPointer (line 94) | typedef uintptr_t ZyanUPointer;
type ZyanIPointer (line 95) | typedef intptr_t ZyanIPointer;
type ZyanU8 (line 151) | typedef ZyanU8 ZyanBool;
type ZyanI8 (line 163) | typedef ZyanI8 ZyanTernary;
FILE: vendor/zycore/include/Zycore/Vector.h
type ZyanVector (line 76) | typedef struct ZyanVector_
FILE: vendor/zycore/src/API/Memory.c
function ZyanU32 (line 45) | ZyanU32 ZyanMemoryGetSystemPageSize()
function ZyanU32 (line 61) | ZyanU32 ZyanMemoryGetSystemAllocationGranularity()
function ZyanStatus (line 81) | ZyanStatus ZyanMemoryVirtualProtect(void* address, ZyanUSize size,
function ZyanStatus (line 104) | ZyanStatus ZyanMemoryVirtualFree(void* address, ZyanUSize size)
FILE: vendor/zycore/src/API/Process.c
function ZyanStatus (line 45) | ZyanStatus ZyanProcessFlushInstructionCache(void* address, ZyanUSize size)
FILE: vendor/zycore/src/API/Synchronization.c
function ZyanStatus (line 53) | ZyanStatus ZyanCriticalSectionInitialize(ZyanCriticalSection* critical_s...
function ZyanStatus (line 94) | ZyanStatus ZyanCriticalSectionEnter(ZyanCriticalSection* critical_section)
function ZyanBool (line 113) | ZyanBool ZyanCriticalSectionTryEnter(ZyanCriticalSection* critical_section)
function ZyanStatus (line 119) | ZyanStatus ZyanCriticalSectionLeave(ZyanCriticalSection* critical_section)
function ZyanStatus (line 138) | ZyanStatus ZyanCriticalSectionDelete(ZyanCriticalSection* critical_section)
function ZyanStatus (line 161) | ZyanStatus ZyanCriticalSectionInitialize(ZyanCriticalSection* critical_s...
function ZyanStatus (line 168) | ZyanStatus ZyanCriticalSectionEnter(ZyanCriticalSection* critical_section)
function ZyanBool (line 175) | ZyanBool ZyanCriticalSectionTryEnter(ZyanCriticalSection* critical_section)
function ZyanStatus (line 180) | ZyanStatus ZyanCriticalSectionLeave(ZyanCriticalSection* critical_section)
function ZyanStatus (line 187) | ZyanStatus ZyanCriticalSectionDelete(ZyanCriticalSection* critical_section)
FILE: vendor/zycore/src/API/Terminal.c
function ZyanStatus (line 49) | ZyanStatus ZyanTerminalEnableVT100(ZyanStandardStream stream)
function ZyanStatus (line 98) | ZyanStatus ZyanTerminalIsTTY(ZyanStandardStream stream)
FILE: vendor/zycore/src/API/Thread.c
function ZyanStatus (line 53) | ZyanStatus ZyanThreadGetCurrentThread(ZyanThread* thread)
function ZyanStatus (line 61) | ZyanStatus ZyanThreadGetCurrentThreadId(ZyanThreadId* thread_id)
function ZyanStatus (line 75) | ZyanStatus ZyanThreadTlsAlloc(ZyanThreadTlsIndex* index, ZyanThreadTlsCa...
function ZyanStatus (line 96) | ZyanStatus ZyanThreadTlsFree(ZyanThreadTlsIndex index)
function ZyanStatus (line 101) | ZyanStatus ZyanThreadTlsGetValue(ZyanThreadTlsIndex index, void** data)
function ZyanStatus (line 108) | ZyanStatus ZyanThreadTlsSetValue(ZyanThreadTlsIndex index, void* data)
function ZyanStatus (line 131) | ZyanStatus ZyanThreadGetCurrentThread(ZyanThread* thread)
function ZyanStatus (line 138) | ZyanStatus ZyanThreadGetCurrentThreadId(ZyanThreadId* thread_id)
function ZyanStatus (line 149) | ZyanStatus ZyanThreadTlsAlloc(ZyanThreadTlsIndex* index, ZyanThreadTlsCa...
function ZyanStatus (line 161) | ZyanStatus ZyanThreadTlsFree(ZyanThreadTlsIndex index)
function ZyanStatus (line 166) | ZyanStatus ZyanThreadTlsGetValue(ZyanThreadTlsIndex index, void** data)
function ZyanStatus (line 173) | ZyanStatus ZyanThreadTlsSetValue(ZyanThreadTlsIndex index, void* data)
FILE: vendor/zycore/src/Allocator.c
function ZyanStatus (line 40) | static ZyanStatus ZyanAllocatorDefaultAllocate(ZyanAllocator* allocator,...
function ZyanStatus (line 59) | static ZyanStatus ZyanAllocatorDefaultReallocate(ZyanAllocator* allocato...
function ZyanStatus (line 79) | static ZyanStatus ZyanAllocatorDefaultDeallocate(ZyanAllocator* allocato...
function ZyanStatus (line 104) | ZyanStatus ZyanAllocatorInit(ZyanAllocator* allocator, ZyanAllocatorAllo...
function ZyanAllocator (line 121) | ZyanAllocator* ZyanAllocatorDefault(void)
FILE: vendor/zycore/src/ArgParse.c
function ZyanStatus (line 36) | ZyanStatus ZyanArgParse(const ZyanArgParseConfig *cfg, ZyanVector* parsed,
function ZyanStatus (line 44) | ZyanStatus ZyanArgParseEx(const ZyanArgParseConfig *cfg, ZyanVector* par...
FILE: vendor/zycore/src/Bitset.c
function ZyanStatus (line 87) | static ZyanStatus ZyanBitsetInitVectorElements(ZyanVector* vector, ZyanU...
function ZyanStatus (line 104) | static ZyanStatus ZyanBitsetOperationAND(ZyanU8* b1, const ZyanU8* b2)
function ZyanStatus (line 110) | static ZyanStatus ZyanBitsetOperationOR (ZyanU8* b1, const ZyanU8* b2)
function ZyanStatus (line 116) | static ZyanStatus ZyanBitsetOperationXOR(ZyanU8* b1, const ZyanU8* b2)
function ZyanStatus (line 134) | ZyanStatus ZyanBitsetInit(ZyanBitset* bitset, ZyanUSize count)
function ZyanStatus (line 142) | ZyanStatus ZyanBitsetInitEx(ZyanBitset* bitset, ZyanUSize count, ZyanAll...
function ZyanStatus (line 160) | ZyanStatus ZyanBitsetInitBuffer(ZyanBitset* bitset, ZyanUSize count, voi...
function ZyanStatus (line 182) | ZyanStatus ZyanBitsetDestroy(ZyanBitset* bitset)
function ZyanStatus (line 196) | ZyanStatus ZyanBitsetPerformByteOperation(ZyanBitset* destination, const...
function ZyanStatus (line 226) | ZyanStatus ZyanBitsetAND(ZyanBitset* destination, const ZyanBitset* source)
function ZyanStatus (line 231) | ZyanStatus ZyanBitsetOR (ZyanBitset* destination, const ZyanBitset* source)
function ZyanStatus (line 236) | ZyanStatus ZyanBitsetXOR(ZyanBitset* destination, const ZyanBitset* source)
function ZyanStatus (line 241) | ZyanStatus ZyanBitsetFlip(ZyanBitset* bitset)
function ZyanStatus (line 264) | ZyanStatus ZyanBitsetSet(ZyanBitset* bitset, ZyanUSize index)
function ZyanStatus (line 283) | ZyanStatus ZyanBitsetReset(ZyanBitset* bitset, ZyanUSize index)
function ZyanStatus (line 301) | ZyanStatus ZyanBitsetAssign(ZyanBitset* bitset, ZyanUSize index, ZyanBoo...
function ZyanStatus (line 310) | ZyanStatus ZyanBitsetToggle(ZyanBitset* bitset, ZyanUSize index)
function ZyanStatus (line 328) | ZyanStatus ZyanBitsetTest(ZyanBitset* bitset, ZyanUSize index)
function ZyanStatus (line 348) | ZyanStatus ZyanBitsetTestMSB(ZyanBitset* bitset)
function ZyanStatus (line 358) | ZyanStatus ZyanBitsetTestLSB(ZyanBitset* bitset)
function ZyanStatus (line 365) | ZyanStatus ZyanBitsetSetAll(ZyanBitset* bitset)
function ZyanStatus (line 384) | ZyanStatus ZyanBitsetResetAll(ZyanBitset* bitset)
function ZyanStatus (line 407) | ZyanStatus ZyanBitsetPush(ZyanBitset* bitset, ZyanBool value)
function ZyanStatus (line 423) | ZyanStatus ZyanBitsetPop(ZyanBitset* bitset)
function ZyanStatus (line 438) | ZyanStatus ZyanBitsetClear(ZyanBitset* bitset)
function ZyanStatus (line 453) | ZyanStatus ZyanBitsetReserve(ZyanBitset* bitset, ZyanUSize count)
function ZyanStatus (line 458) | ZyanStatus ZyanBitsetShrinkToFit(ZyanBitset* bitset)
function ZyanStatus (line 467) | ZyanStatus ZyanBitsetGetSize(const ZyanBitset* bitset, ZyanUSize* size)
function ZyanStatus (line 479) | ZyanStatus ZyanBitsetGetCapacity(const ZyanBitset* bitset, ZyanUSize* ca...
function ZyanStatus (line 487) | ZyanStatus ZyanBitsetGetSizeBytes(const ZyanBitset* bitset, ZyanUSize* s...
function ZyanStatus (line 497) | ZyanStatus ZyanBitsetGetCapacityBytes(const ZyanBitset* bitset, ZyanUSiz...
function ZyanStatus (line 509) | ZyanStatus ZyanBitsetCount(const ZyanBitset* bitset, ZyanUSize* count)
function ZyanStatus (line 538) | ZyanStatus ZyanBitsetAll(const ZyanBitset* bitset)
function ZyanStatus (line 570) | ZyanStatus ZyanBitsetAny(const ZyanBitset* bitset)
function ZyanStatus (line 602) | ZyanStatus ZyanBitsetNone(const ZyanBitset* bitset)
FILE: vendor/zycore/src/Format.c
function ZyanStatus (line 87) | ZyanStatus ZyanStringAppendDecU32(ZyanString* string, ZyanU32 value, Zya...
function ZyanStatus (line 133) | ZyanStatus ZyanStringAppendDecU64(ZyanString* string, ZyanU64 value, Zya...
function ZyanStatus (line 183) | ZyanStatus ZyanStringAppendHexU32(ZyanString* string, ZyanU32 value, Zya...
function ZyanStatus (line 254) | ZyanStatus ZyanStringAppendHexU64(ZyanString* string, ZyanU64 value, Zya...
function ZyanStatus (line 372) | ZyanStatus ZyanStringAppendFormat(ZyanString* string, const char* format...
function ZyanStatus (line 424) | ZyanStatus ZyanStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU...
function ZyanStatus (line 438) | ZyanStatus ZyanStringAppendDecS(ZyanString* string, ZyanI64 value, ZyanU...
function ZyanStatus (line 464) | ZyanStatus ZyanStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU...
function ZyanStatus (line 479) | ZyanStatus ZyanStringAppendHexS(ZyanString* string, ZyanI64 value, ZyanU...
FILE: vendor/zycore/src/List.c
function ZyanStatus (line 60) | static ZyanStatus ZyanListAllocateNode(ZyanList* list, ZyanListNode** node)
function ZyanStatus (line 100) | static ZyanStatus ZyanListDeallocateNode(ZyanList* list, ZyanListNode* n...
function ZYAN_REQUIRES_LIBC (line 132) | ZYAN_REQUIRES_LIBC ZyanStatus ZyanListInit(ZyanList* list, ZyanUSize ele...
function ZyanStatus (line 140) | ZyanStatus ZyanListInitEx(ZyanList* list, ZyanUSize element_size, ZyanMe...
function ZyanStatus (line 161) | ZyanStatus ZyanListInitCustomBuffer(ZyanList* list, ZyanUSize element_size,
function ZyanStatus (line 182) | ZyanStatus ZyanListDestroy(ZyanList* list)
function ZyanStatus (line 224) | ZyanStatus ZyanListGetHeadNode(const ZyanList* list, const ZyanListNode*...
function ZyanStatus (line 236) | ZyanStatus ZyanListGetTailNode(const ZyanList* list, const ZyanListNode*...
function ZyanStatus (line 248) | ZyanStatus ZyanListGetPrevNode(const ZyanListNode** node)
function ZyanStatus (line 260) | ZyanStatus ZyanListGetNextNode(const ZyanListNode** node)
function ZyanStatus (line 282) | ZyanStatus ZyanListGetNodeDataEx(const ZyanListNode* node, const void** ...
function ZyanStatus (line 304) | ZyanStatus ZyanListGetNodeDataMutableEx(const ZyanListNode* node, void**...
function ZyanStatus (line 316) | ZyanStatus ZyanListSetNodeData(const ZyanList* list, const ZyanListNode*...
function ZyanStatus (line 338) | ZyanStatus ZyanListPushBack(ZyanList* list, const void* item)
function ZyanStatus (line 366) | ZyanStatus ZyanListPushFront(ZyanList* list, const void* item)
function ZyanStatus (line 394) | ZyanStatus ZyanListEmplaceBack(ZyanList* list, void** item, ZyanMemberFu...
function ZyanStatus (line 426) | ZyanStatus ZyanListEmplaceFront(ZyanList* list, void** item, ZyanMemberF...
function ZyanStatus (line 462) | ZyanStatus ZyanListPopBack(ZyanList* list)
function ZyanStatus (line 494) | ZyanStatus ZyanListPopFront(ZyanList* list)
function ZyanStatus (line 526) | ZyanStatus ZyanListRemove(ZyanList* list, const ZyanListNode* node)
function ZyanStatus (line 533) | ZyanStatus ZyanListRemoveRange(ZyanList* list, const ZyanListNode* first...
function ZyanStatus (line 541) | ZyanStatus ZyanListClear(ZyanList* list)
function ZyanStatus (line 556) | ZyanStatus ZyanListResize(ZyanList* list, ZyanUSize size)
function ZyanStatus (line 561) | ZyanStatus ZyanListResizeEx(ZyanList* list, ZyanUSize size, const void* ...
function ZyanStatus (line 659) | ZyanStatus ZyanListGetSize(const ZyanList* list, ZyanUSize* size)
FILE: vendor/zycore/src/String.c
function ZyanStatus (line 56) | ZyanStatus ZyanStringInit(ZyanString* string, ZyanUSize capacity)
function ZyanStatus (line 64) | ZyanStatus ZyanStringInitEx(ZyanString* string, ZyanUSize capacity, Zyan...
function ZyanStatus (line 86) | ZyanStatus ZyanStringInitCustomBuffer(ZyanString* string, char* buffer, ...
function ZyanStatus (line 106) | ZyanStatus ZyanStringDestroy(ZyanString* string)
function ZyanStatus (line 126) | ZyanStatus ZyanStringDuplicate(ZyanString* destination, const ZyanString...
function ZyanStatus (line 135) | ZyanStatus ZyanStringDuplicateEx(ZyanString* destination, const ZyanStri...
function ZyanStatus (line 156) | ZyanStatus ZyanStringDuplicateCustomBuffer(ZyanString* destination, cons...
function ZyanStatus (line 187) | ZyanStatus ZyanStringConcat(ZyanString* destination, const ZyanStringVie...
function ZyanStatus (line 196) | ZyanStatus ZyanStringConcatEx(ZyanString* destination, const ZyanStringV...
function ZyanStatus (line 219) | ZyanStatus ZyanStringConcatCustomBuffer(ZyanString* destination, const Z...
function ZyanStatus (line 249) | ZyanStatus ZyanStringViewInsideView(ZyanStringView* view, const ZyanStri...
function ZyanStatus (line 262) | ZyanStatus ZyanStringViewInsideViewEx(ZyanStringView* view, const ZyanSt...
function ZyanStatus (line 281) | ZyanStatus ZyanStringViewInsideBuffer(ZyanStringView* view, const char* ...
function ZyanStatus (line 294) | ZyanStatus ZyanStringViewInsideBufferEx(ZyanStringView* view, const char...
function ZyanStatus (line 307) | ZyanStatus ZyanStringViewGetSize(const ZyanStringView* view, ZyanUSize* ...
function ZYCORE_EXPORT (line 320) | ZYCORE_EXPORT ZyanStatus ZyanStringViewGetData(const ZyanStringView* vie...
function ZyanStatus (line 336) | ZyanStatus ZyanStringGetChar(const ZyanStringView* string, ZyanUSize ind...
function ZyanStatus (line 356) | ZyanStatus ZyanStringGetCharMutable(ZyanString* string, ZyanUSize index,...
function ZyanStatus (line 372) | ZyanStatus ZyanStringSetChar(ZyanString* string, ZyanUSize index, char v...
function ZyanStatus (line 392) | ZyanStatus ZyanStringInsert(ZyanString* destination, ZyanUSize index, co...
function ZyanStatus (line 417) | ZyanStatus ZyanStringInsertEx(ZyanString* destination, ZyanUSize destina...
function ZyanStatus (line 453) | ZyanStatus ZyanStringAppend(ZyanString* destination, const ZyanStringVie...
function ZyanStatus (line 469) | ZyanStatus ZyanStringAppendEx(ZyanString* destination, const ZyanStringV...
function ZyanStatus (line 496) | ZyanStatus ZyanStringDelete(ZyanString* string, ZyanUSize index, ZyanUSi...
function ZyanStatus (line 515) | ZyanStatus ZyanStringTruncate(ZyanString* string, ZyanUSize index)
function ZyanStatus (line 534) | ZyanStatus ZyanStringClear(ZyanString* string)
function ZyanStatus (line 555) | ZyanStatus ZyanStringLPos(const ZyanStringView* haystack, const ZyanStri...
function ZyanStatus (line 566) | ZyanStatus ZyanStringLPosEx(const ZyanStringView* haystack, const ZyanSt...
function ZyanStatus (line 620) | ZyanStatus ZyanStringLPosI(const ZyanStringView* haystack, const ZyanStr...
function ZyanStatus (line 631) | ZyanStatus ZyanStringLPosIEx(const ZyanStringView* haystack, const ZyanS...
function ZyanStatus (line 691) | ZyanStatus ZyanStringRPos(const ZyanStringView* haystack, const ZyanStri...
function ZyanStatus (line 703) | ZyanStatus ZyanStringRPosEx(const ZyanStringView* haystack, const ZyanSt...
function ZyanStatus (line 758) | ZyanStatus ZyanStringRPosI(const ZyanStringView* haystack, const ZyanStr...
function ZyanStatus (line 770) | ZyanStatus ZyanStringRPosIEx(const ZyanStringView* haystack, const ZyanS...
function ZyanStatus (line 835) | ZyanStatus ZyanStringCompare(const ZyanStringView* s1, const ZyanStringV...
function ZyanStatus (line 881) | ZyanStatus ZyanStringCompareI(const ZyanStringView* s1, const ZyanString...
function ZyanStatus (line 935) | ZyanStatus ZyanStringToLowerCase(ZyanString* string)
function ZyanStatus (line 945) | ZyanStatus ZyanStringToLowerCaseEx(ZyanString* string, ZyanUSize index, ...
function ZyanStatus (line 976) | ZyanStatus ZyanStringToUpperCase(ZyanString* string)
function ZyanStatus (line 986) | ZyanStatus ZyanStringToUpperCaseEx(ZyanString* string, ZyanUSize index, ...
function ZyanStatus (line 1021) | ZyanStatus ZyanStringResize(ZyanString* string, ZyanUSize size)
function ZyanStatus (line 1034) | ZyanStatus ZyanStringReserve(ZyanString* string, ZyanUSize capacity)
function ZyanStatus (line 1044) | ZyanStatus ZyanStringShrinkToFit(ZyanString* string)
function ZyanStatus (line 1058) | ZyanStatus ZyanStringGetCapacity(const ZyanString* string, ZyanUSize* ca...
function ZyanStatus (line 1071) | ZyanStatus ZyanStringGetSize(const ZyanString* string, ZyanUSize* size)
function ZyanStatus (line 1084) | ZyanStatus ZyanStringGetData(const ZyanString* string, const char** value)
FILE: vendor/zycore/src/Vector.c
function ZyanStatus (line 84) | static ZyanStatus ZyanVectorReallocate(ZyanVector* vector, ZyanUSize cap...
function ZyanStatus (line 131) | static ZyanStatus ZyanVectorShiftLeft(ZyanVector* vector, ZyanUSize inde...
function ZyanStatus (line 157) | static ZyanStatus ZyanVectorShiftRight(ZyanVector* vector, ZyanUSize ind...
function ZyanStatus (line 185) | ZyanStatus ZyanVectorInit(ZyanVector* vector, ZyanUSize element_size, Zy...
function ZyanStatus (line 194) | ZyanStatus ZyanVectorInitEx(ZyanVector* vector, ZyanUSize element_size, ...
function ZyanStatus (line 219) | ZyanStatus ZyanVectorInitCustomBuffer(ZyanVector* vector, ZyanUSize elem...
function ZyanStatus (line 239) | ZyanStatus ZyanVectorDestroy(ZyanVector* vector)
function ZyanStatus (line 274) | ZyanStatus ZyanVectorDuplicate(ZyanVector* destination, const ZyanVector...
function ZyanStatus (line 283) | ZyanStatus ZyanVectorDuplicateEx(ZyanVector* destination, const ZyanVect...
function ZyanStatus (line 304) | ZyanStatus ZyanVectorDuplicateCustomBuffer(ZyanVector* destination, cons...
function ZyanStatus (line 359) | ZyanStatus ZyanVectorGetPointer(const ZyanVector* vector, ZyanUSize inde...
function ZyanStatus (line 378) | ZyanStatus ZyanVectorGetPointerMutable(const ZyanVector* vector, ZyanUSi...
function ZyanStatus (line 397) | ZyanStatus ZyanVectorSet(ZyanVector* vector, ZyanUSize index, const void...
function ZyanStatus (line 425) | ZyanStatus ZyanVectorPushBack(ZyanVector* vector, const void* element)
function ZyanStatus (line 449) | ZyanStatus ZyanVectorInsert(ZyanVector* vector, ZyanUSize index, const v...
function ZyanStatus (line 454) | ZyanStatus ZyanVectorInsertRange(ZyanVector* vector, ZyanUSize index, co...
function ZyanStatus (line 487) | ZyanStatus ZyanVectorEmplace(ZyanVector* vector, void** element, ZyanMem...
function ZyanStatus (line 497) | ZyanStatus ZyanVectorEmplaceEx(ZyanVector* vector, ZyanUSize index, void...
function ZyanStatus (line 538) | ZyanStatus ZyanVectorSwapElements(ZyanVector* vector, ZyanUSize index_fi...
function ZyanStatus (line 571) | ZyanStatus ZyanVectorDelete(ZyanVector* vector, ZyanUSize index)
function ZyanStatus (line 576) | ZyanStatus ZyanVectorDeleteRange(ZyanVector* vector, ZyanUSize index, Zy...
function ZyanStatus (line 610) | ZyanStatus ZyanVectorPopBack(ZyanVector* vector)
function ZyanStatus (line 636) | ZyanStatus ZyanVectorClear(ZyanVector* vector)
function ZyanStatus (line 645) | ZyanStatus ZyanVectorFind(const ZyanVector* vector, const void* element,...
function ZyanStatus (line 656) | ZyanStatus ZyanVectorFindEx(const ZyanVector* vector, const void* elemen...
function ZyanStatus (line 690) | ZyanStatus ZyanVectorBinarySearch(const ZyanVector* vector, const void* ...
function ZyanStatus (line 701) | ZyanStatus ZyanVectorBinarySearchEx(const ZyanVector* vector, const void...
function ZyanStatus (line 750) | ZyanStatus ZyanVectorResize(ZyanVector* vector, ZyanUSize size)
function ZyanStatus (line 755) | ZyanStatus ZyanVectorResizeEx(ZyanVector* vector, ZyanUSize size, const ...
function ZyanStatus (line 793) | ZyanStatus ZyanVectorReserve(ZyanVector* vector, ZyanUSize capacity)
function ZyanStatus (line 808) | ZyanStatus ZyanVectorShrinkToFit(ZyanVector* vector)
function ZyanStatus (line 822) | ZyanStatus ZyanVectorGetCapacity(const ZyanVector* vector, ZyanUSize* ca...
function ZyanStatus (line 834) | ZyanStatus ZyanVectorGetSize(const ZyanVector* vector, ZyanUSize* size)
FILE: vendor/zycore/src/Zycore.c
function ZyanU64 (line 33) | ZyanU64 ZycoreGetVersion(void)
FILE: vendor/zydis/include/Zydis/Decoder.h
type ZydisDecoderMode (line 55) | typedef enum ZydisDecoderMode_
type ZydisDecoder (line 160) | typedef struct ZydisDecoder_
FILE: vendor/zydis/include/Zydis/DecoderTypes.h
type ZyanU8 (line 56) | typedef ZyanU8 ZydisOperandAttributes;
type ZydisMemoryOperandType (line 75) | typedef enum ZydisMemoryOperandType_
type ZydisDecodedOperand (line 110) | typedef struct ZydisDecodedOperand_
type ZyanU64 (line 249) | typedef ZyanU64 ZydisInstructionAttributes;
type ZyanU32 (line 458) | typedef ZyanU32 ZydisCPUFlags;
type ZyanU8 (line 463) | typedef ZyanU8 ZydisCPUFlag;
type ZyanU8 (line 579) | typedef ZyanU8 ZydisFPUFlags;
type ZydisCPUFlagAction (line 603) | typedef enum ZydisCPUFlagAction_
type ZydisBranchType (line 651) | typedef enum ZydisBranchType_
type ZydisExceptionClass (line 687) | typedef enum ZydisExceptionClass_
type ZydisMaskMode (line 754) | typedef enum ZydisMaskMode_
type ZydisBroadcastMode (line 795) | typedef enum ZydisBroadcastMode_
type ZydisRoundingMode (line 828) | typedef enum ZydisRoundingMode_
type ZydisSwizzleMode (line 865) | typedef enum ZydisSwizzleMode_
type ZydisConversionMode (line 894) | typedef enum ZydisConversionMode_
type ZydisPrefixType (line 920) | typedef enum ZydisPrefixType_
type ZydisDecodedInstruction (line 960) | typedef struct ZydisDecodedInstruction_
FILE: vendor/zydis/include/Zydis/Formatter.h
type ZydisFormatterStyle (line 66) | typedef enum ZydisFormatterStyle_
type ZydisFormatterProperty (line 101) | typedef enum ZydisFormatterProperty_
type ZydisNumericBase (line 330) | typedef enum ZydisNumericBase_
type ZydisSignedness (line 356) | typedef enum ZydisSignedness_
type ZydisPadding (line 387) | typedef enum ZydisPadding_
type ZydisFormatterFunction (line 419) | typedef enum ZydisFormatterFunction_
type ZydisDecorator (line 580) | typedef enum ZydisDecorator_
type ZydisFormatter (line 626) | typedef struct ZydisFormatter_ ZydisFormatter;
type ZydisFormatterContext (line 631) | typedef struct ZydisFormatterContext_
type ZyanStatus (line 695) | typedef ZyanStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
type ZyanStatus (line 712) | typedef ZyanStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* f...
type ZyanStatus (line 729) | typedef ZyanStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* ...
type ZydisFormatter_ (line 745) | struct ZydisFormatter_
FILE: vendor/zydis/include/Zydis/FormatterBuffer.h
type ZyanU8 (line 55) | typedef ZyanU8 ZydisTokenType;
type ZydisFormatterToken (line 138) | typedef struct ZydisFormatterToken_
type ZydisFormatterToken (line 155) | typedef const ZydisFormatterToken ZydisFormatterTokenConst;
type ZydisFormatterBuffer (line 167) | typedef struct ZydisFormatterBuffer_
FILE: vendor/zydis/include/Zydis/Generated/EnumISAExt.h
type ZydisISAExt (line 4) | typedef enum ZydisISAExt_
FILE: vendor/zydis/include/Zydis/Generated/EnumISASet.h
type ZydisISASet (line 4) | typedef enum ZydisISASet_
FILE: vendor/zydis/include/Zydis/Generated/EnumInstructionCategory.h
type ZydisInstructionCategory (line 4) | typedef enum ZydisInstructionCategory_
FILE: vendor/zydis/include/Zydis/Generated/EnumMnemonic.h
type ZydisMnemonic (line 4) | typedef enum ZydisMnemonic_
FILE: vendor/zydis/include/Zydis/Generated/EnumRegister.h
type ZydisRegister (line 4) | typedef enum ZydisRegister_
FILE: vendor/zydis/include/Zydis/Internal/DecoderData.h
type ZyanU8 (line 56) | typedef ZyanU8 ZydisDecoderTreeNodeType;
type ZydisDecoderTreeNodeTypes (line 61) | enum ZydisDecoderTreeNodeTypes
type ZyanU16 (line 183) | typedef ZyanU16 ZydisDecoderTreeNodeValue;
type ZydisDecoderTreeNode (line 190) | typedef struct ZydisDecoderTreeNode_
type ZyanU8 (line 211) | typedef ZyanU8 ZydisInstructionEncodingFlags;
type ZydisInstructionEncodingInfo (line 244) | typedef struct ZydisInstructionEncodingInfo_
function ZYAN_INLINE (line 297) | ZYAN_INLINE const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void)
FILE: vendor/zydis/include/Zydis/Internal/FormatterBase.h
type ZydisPredefinedToken (line 194) | typedef struct ZydisPredefinedToken_
function ZYAN_INLINE (line 218) | ZYAN_INLINE ZyanStatus ZydisFormatterBufferAppendPredefined(ZydisFormatt...
FILE: vendor/zydis/include/Zydis/Internal/SharedData.h
type ZydisSemanticOperandType (line 59) | typedef enum ZydisSemanticOperandType_
type ZydisInternalElementType (line 110) | typedef enum ZydisInternalElementType_
type ZydisImplicitRegisterType (line 151) | typedef enum ZydisImplicitRegisterType_
type ZydisImplicitMemBase (line 176) | typedef enum ZydisImplicitMemBase_
type ZydisOperandDefinition (line 214) | typedef struct ZydisOperandDefinition_
type ZydisReadWriteAction (line 249) | typedef enum ZydisReadWriteAction_
type ZydisRegisterConstraint (line 271) | typedef enum ZydisRegisterConstraint_
type ZydisInternalVectorLength (line 300) | typedef enum ZydisInternalVectorLength_
type ZydisInternalElementSize (line 322) | typedef enum ZydisInternalElementSize_
type ZydisEVEXFunctionality (line 346) | typedef enum ZydisEVEXFunctionality_
type ZydisEVEXTupleType (line 377) | typedef enum ZydisEVEXTupleType_
type ZydisMVEXFunctionality (line 456) | typedef enum ZydisMVEXFunctionality_
type ZydisVEXStaticBroadcast (line 578) | typedef enum ZydisVEXStaticBroadcast
type ZydisEVEXStaticBroadcast (line 604) | typedef enum ZydisEVEXStaticBroadcast_
type ZydisMVEXStaticBroadcast (line 636) | typedef enum ZydisMVEXStaticBroadcast_
type ZydisMaskPolicy (line 660) | typedef enum ZydisMaskPolicy_
type ZydisMaskOverride (line 692) | typedef enum ZydisMaskOverride_
type ZydisInstructionDefinition (line 761) | typedef struct ZydisInstructionDefinition_
type ZydisInstructionDefinitionLEGACY (line 769) | typedef struct ZydisInstructionDefinitionLEGACY_
type ZydisInstructionDefinition3DNOW (line 792) | typedef struct ZydisInstructionDefinition3DNOW_
type ZydisInstructionDefinitionXOP (line 800) | typedef struct ZydisInstructionDefinitionXOP_
type ZydisInstructionDefinitionVEX (line 812) | typedef struct ZydisInstructionDefinitionVEX_
type ZydisInstructionDefinitionEVEX (line 835) | typedef struct ZydisInstructionDefinitionEVEX_
type ZydisInstructionDefinitionMVEX (line 864) | typedef struct ZydisInstructionDefinitionMVEX_
type ZydisAccessedFlags (line 880) | typedef struct ZydisAccessedFlags_
FILE: vendor/zydis/include/Zydis/Internal/String.h
type ZydisLetterCase (line 65) | typedef enum ZydisLetterCase_
function ZYAN_INLINE (line 130) | ZYAN_INLINE ZyanStatus ZydisStringAppend(ZyanString* destination, const ...
function ZYAN_INLINE (line 160) | ZYAN_INLINE ZyanStatus ZydisStringAppendCase(ZyanString* destination, co...
function ZYAN_INLINE (line 229) | ZYAN_INLINE ZyanStatus ZydisStringAppendShort(ZyanString* destination,
function ZYAN_INLINE (line 260) | ZYAN_INLINE ZyanStatus ZydisStringAppendShortCase(ZyanString* destination,
function ZYAN_INLINE (line 361) | ZYAN_INLINE ZyanStatus ZydisStringAppendDecS(ZyanString* string, ZyanI64...
function ZYAN_INLINE (line 430) | ZYAN_INLINE ZyanStatus ZydisStringAppendHexS(ZyanString* string, ZyanI64...
FILE: vendor/zydis/include/Zydis/Register.h
type ZydisRegisterClass (line 68) | typedef enum ZydisRegisterClass_
type ZyanU16 (line 161) | typedef ZyanU16 ZydisRegisterWidth;
type ZydisRegisterContext (line 170) | typedef struct ZydisRegisterContext_
FILE: vendor/zydis/include/Zydis/SharedTypes.h
type ZydisMachineMode (line 65) | typedef enum ZydisMachineMode_
type ZydisAddressWidth (line 109) | typedef enum ZydisAddressWidth_
type ZydisElementType (line 132) | typedef enum ZydisElementType_
type ZyanU16 (line 189) | typedef ZyanU16 ZydisElementSize;
type ZydisOperandType (line 198) | typedef enum ZydisOperandType_
type ZydisOperandEncoding (line 238) | typedef enum ZydisOperandEncoding_
type ZydisOperandVisibility (line 293) | typedef enum ZydisOperandVisibility_
type ZydisOperandAction (line 327) | typedef enum ZydisOperandAction_
type ZyanU8 (line 397) | typedef ZyanU8 ZydisOperandActions;
type ZydisInstructionEncoding (line 406) | typedef enum ZydisInstructionEncoding_
type ZydisOpcodeMap (line 451) | typedef enum ZydisOpcodeMap_
FILE: vendor/zydis/include/Zydis/ShortString.h
type ZydisShortString (line 58) | typedef struct ZydisShortString_
FILE: vendor/zydis/include/Zydis/Utils.h
type ZydisInstructionSegment (line 62) | typedef enum ZydisInstructionSegment_
type ZydisInstructionSegments (line 123) | typedef struct ZydisInstructionSegments_
FILE: vendor/zydis/include/Zydis/Zydis.h
type ZydisFeature (line 112) | typedef enum ZydisFeature_
FILE: vendor/zydis/src/Decoder.c
type ZydisDecoderContext (line 44) | typedef struct ZydisDecoderContext_
type ZydisRegisterEncoding (line 203) | typedef enum ZydisRegisterEncoding_
function ZyanStatus (line 292) | static ZyanStatus ZydisInputPeek(ZydisDecoderContext* context,
function ZydisInputSkip (line 323) | static void ZydisInputSkip(ZydisDecoderContext* context, ZydisDecodedIns...
function ZyanStatus (line 346) | static ZyanStatus ZydisInputNext(ZydisDecoderContext* context,
function ZyanStatus (line 383) | static ZyanStatus ZydisInputNextBytes(ZydisDecoderContext* context,
function ZydisDecodeREX (line 420) | static void ZydisDecodeREX(ZydisDecoderContext* context, ZydisDecodedIns...
function ZyanStatus (line 448) | static ZyanStatus ZydisDecodeXOP(ZydisDecoderContext* context,
function ZyanStatus (line 494) | static ZyanStatus ZydisDecodeVEX(ZydisDecoderContext* context,
function ZyanStatus (line 564) | static ZyanStatus ZydisDecodeEVEX(ZydisDecoderContext* context,
function ZyanStatus (line 652) | static ZyanStatus ZydisDecodeMVEX(ZydisDecoderContext* context,
function ZydisDecodeModRM (line 705) | static void ZydisDecodeModRM(ZydisDecodedInstruction* instruction, ZyanU...
function ZydisDecodeSIB (line 723) | static void ZydisDecodeSIB(ZydisDecodedInstruction* instruction, ZyanU8 ...
function ZyanStatus (line 748) | static ZyanStatus ZydisReadDisplacement(ZydisDecoderContext* context,
function ZyanStatus (line 809) | static ZyanStatus ZydisReadImmediate(ZydisDecoderContext* context,
function ZyanU8 (line 904) | static ZyanU8 ZydisCalcRegisterId(ZydisDecoderContext* context,
function ZydisSetOperandSizeAndElementInfo (line 1131) | static void ZydisSetOperandSizeAndElementInfo(ZydisDecoderContext* context,
function ZyanStatus (line 1376) | static ZyanStatus ZydisDecodeOperandRegister(ZydisDecodedInstruction* in...
function ZyanStatus (line 1419) | static ZyanStatus ZydisDecodeOperandMemory(ZydisDecoderContext* context,
function ZydisDecodeOperandImplicitRegister (line 1610) | static void ZydisDecodeOperandImplicitRegister(ZydisDecoderContext* cont...
function ZydisDecodeOperandImplicitMemory (line 1683) | static void ZydisDecodeOperandImplicitMemory(ZydisDecoderContext* context,
function ZyanStatus (line 1759) | static ZyanStatus ZydisDecodeOperands(ZydisDecoderContext* context,
function ZydisSetAttributes (line 2138) | static void ZydisSetAttributes(ZydisDecoderContext* context, ZydisDecode...
function ZydisSetAVXInformation (line 2425) | static void ZydisSetAVXInformation(ZydisDecoderContext* context,
function ZyanStatus (line 3137) | static ZyanStatus ZydisCollectOptionalPrefixes(ZydisDecoderContext* cont...
function ZyanStatus (line 3260) | static ZyanStatus ZydisDecodeOptionalInstructionParts(ZydisDecoderContex...
function ZydisSetEffectiveOperandWidth (line 3389) | static void ZydisSetEffectiveOperandWidth(ZydisDecoderContext* context,
function ZydisSetEffectiveAddressWidth (line 3543) | static void ZydisSetEffectiveAddressWidth(ZydisDecoderContext* context,
function ZyanStatus (line 3619) | static ZyanStatus ZydisNodeHandlerXOP(ZydisDecodedInstruction* instructi...
function ZyanStatus (line 3639) | static ZyanStatus ZydisNodeHandlerVEX(ZydisDecodedInstruction* instructi...
function ZyanStatus (line 3659) | static ZyanStatus ZydisNodeHandlerEMVEX(ZydisDecodedInstruction* instruc...
function ZyanStatus (line 3683) | static ZyanStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context,
function ZyanStatus (line 3892) | static ZyanStatus ZydisNodeHandlerMode(ZydisDecoderContext* context, Zya...
function ZyanStatus (line 3917) | static ZyanStatus ZydisNodeHandlerModeCompact(ZydisDecoderContext* conte...
function ZyanStatus (line 3926) | static ZyanStatus ZydisNodeHandlerModrmMod(ZydisDecoderContext* context,
function ZyanStatus (line 3944) | static ZyanStatus ZydisNodeHandlerModrmModCompact(ZydisDecoderContext* c...
function ZyanStatus (line 3952) | static ZyanStatus ZydisNodeHandlerModrmReg(ZydisDecoderContext* context,
function ZyanStatus (line 3970) | static ZyanStatus ZydisNodeHandlerModrmRm(ZydisDecoderContext* context,
function ZyanStatus (line 3988) | static ZyanStatus ZydisNodeHandlerMandatoryPrefix(ZydisDecoderContext* c...
function ZyanStatus (line 4022) | static ZyanStatus ZydisNodeHandlerOperandSize(ZydisDecoderContext* context,
function ZyanStatus (line 4059) | static ZyanStatus ZydisNodeHandlerAddressSize(ZydisDecoderContext* context,
function ZyanStatus (line 4088) | static ZyanStatus ZydisNodeHandlerVectorLength(ZydisDecoderContext* cont...
function ZyanStatus (line 4121) | static ZyanStatus ZydisNodeHandlerRexW(ZydisDecoderContext* context,
function ZyanStatus (line 4152) | static ZyanStatus ZydisNodeHandlerRexB(ZydisDecoderContext* context,
function ZyanStatus (line 4184) | static ZyanStatus ZydisNodeHandlerEvexB(ZydisDecodedInstruction* instruc...
function ZyanStatus (line 4197) | static ZyanStatus ZydisNodeHandlerMvexE(ZydisDecodedInstruction* instruc...
function ZyanStatus (line 4222) | static ZyanStatus ZydisCheckErrorConditions(ZydisDecoderContext* context,
function ZyanStatus (line 4613) | static ZyanStatus ZydisDecodeInstruction(ZydisDecoderContext* context,
function ZyanStatus (line 4838) | ZyanStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode mach...
function ZyanStatus (line 4891) | ZyanStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDecoderMod...
function ZyanStatus (line 4910) | ZyanStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder, const v...
FILE: vendor/zydis/src/DecoderData.c
function ZydisDecoderTreeNode (line 68) | const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDeco...
function ZydisGetInstructionEncodingInfo (line 163) | void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
FILE: vendor/zydis/src/Formatter.c
function ZydisFormatterBufferInit (line 58) | void ZydisFormatterBufferInit(ZydisFormatterBuffer* buffer, char* user_b...
function ZydisFormatterBufferInitTokenized (line 75) | void ZydisFormatterBufferInitTokenized(ZydisFormatterBuffer* buffer,
function ZyanStatus (line 111) | ZyanStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterS...
function ZyanStatus (line 127) | ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter, ZydisFor...
function ZyanStatus (line 344) | ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatt...
function ZyanStatus (line 418) | ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
function ZyanStatus (line 426) | ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* forma...
function ZyanStatus (line 459) | ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
function ZyanStatus (line 467) | ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
function ZyanStatus (line 524) | ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* forma...
function ZyanStatus (line 532) | ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* for...
function ZyanStatus (line 574) | ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
function ZyanStatus (line 582) | ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
FILE: vendor/zydis/src/FormatterATT.c
function ZyanStatus (line 43) | ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* form...
function ZyanStatus (line 193) | ZyanStatus ZydisFormatterATTFormatOperandMEM(const ZydisFormatter* forma...
function ZyanStatus (line 264) | ZyanStatus ZydisFormatterATTPrintMnemonic(const ZydisFormatter* formatter,
function ZyanStatus (line 337) | ZyanStatus ZydisFormatterATTPrintRegister(const ZydisFormatter* formatter,
function ZyanStatus (line 356) | ZyanStatus ZydisFormatterATTPrintDISP(const ZydisFormatter* formatter,
function ZyanStatus (line 382) | ZyanStatus ZydisFormatterATTPrintIMM(const ZydisFormatter* formatter,
FILE: vendor/zydis/src/FormatterBase.c
function ZyanU32 (line 80) | ZyanU32 ZydisFormatterHelperGetExplicitSize(const ZydisFormatter* format...
function ZyanStatus (line 138) | ZyanStatus ZydisFormatterBaseFormatOperandREG(const ZydisFormatter* form...
function ZyanStatus (line 148) | ZyanStatus ZydisFormatterBaseFormatOperandPTR(const ZydisFormatter* form...
function ZyanStatus (line 166) | ZyanStatus ZydisFormatterBaseFormatOperandIMM(const ZydisFormatter* form...
function ZyanStatus (line 193) | ZyanStatus ZydisFormatterBasePrintAddressABS(const ZydisFormatter* forma...
function ZyanStatus (line 232) | ZyanStatus ZydisFormatterBasePrintAddressREL(const ZydisFormatter* forma...
function ZyanStatus (line 285) | ZyanStatus ZydisFormatterBasePrintIMM(const ZydisFormatter* formatter,
function ZyanStatus (line 348) | ZyanStatus ZydisFormatterBasePrintSegment(const ZydisFormatter* formatter,
function ZyanStatus (line 395) | ZyanStatus ZydisFormatterBasePrintPrefixes(const ZydisFormatter* formatter,
function ZyanStatus (line 546) | ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* format...
FILE: vendor/zydis/src/FormatterBuffer.c
function ZyanStatus (line 38) | ZyanStatus ZydisFormatterTokenGetValue(const ZydisFormatterToken* token,
function ZyanStatus (line 52) | ZyanStatus ZydisFormatterTokenNext(ZydisFormatterTokenConst** token)
function ZyanStatus (line 73) | ZyanStatus ZydisFormatterBufferGetToken(const ZydisFormatterBuffer* buffer,
function ZyanStatus (line 90) | ZyanStatus ZydisFormatterBufferGetString(ZydisFormatterBuffer* buffer, Z...
function ZyanStatus (line 111) | ZyanStatus ZydisFormatterBufferAppend(ZydisFormatterBuffer* buffer, Zydi...
function ZyanStatus (line 147) | ZyanStatus ZydisFormatterBufferRemember(const ZydisFormatterBuffer* buff...
function ZyanStatus (line 165) | ZyanStatus ZydisFormatterBufferRestore(ZydisFormatterBuffer* buffer, Zya...
FILE: vendor/zydis/src/FormatterIntel.c
function ZyanStatus (line 45) | ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* fo...
function ZyanStatus (line 189) | ZyanStatus ZydisFormatterIntelFormatOperandMEM(const ZydisFormatter* for...
function ZyanStatus (line 254) | ZyanStatus ZydisFormatterIntelPrintMnemonic(const ZydisFormatter* format...
function ZyanStatus (line 295) | ZyanStatus ZydisFormatterIntelPrintRegister(const ZydisFormatter* format...
function ZyanStatus (line 315) | ZyanStatus ZydisFormatterIntelPrintDISP(const ZydisFormatter* formatter,
function ZyanStatus (line 356) | ZyanStatus ZydisFormatterIntelPrintTypecast(const ZydisFormatter* format...
function ZyanStatus (line 385) | ZyanStatus ZydisFormatterIntelFormatInstructionMASM(const ZydisFormatter...
function ZyanStatus (line 400) | ZyanStatus ZydisFormatterIntelPrintAddressMASM(const ZydisFormatter* for...
FILE: vendor/zydis/src/Mnemonic.c
function ZydisShortString (line 43) | const ZydisShortString* ZydisMnemonicGetStringWrapped(ZydisMnemonic mnem...
FILE: vendor/zydis/src/Register.c
type ZydisRegisterMapItem (line 42) | typedef struct ZydisRegisterMapItem_
function ZydisRegister (line 100) | ZydisRegister ZydisRegisterEncode(ZydisRegisterClass register_class, Zya...
function ZyanI8 (line 118) | ZyanI8 ZydisRegisterGetId(ZydisRegister reg)
function ZydisRegisterClass (line 138) | ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg)
function ZydisRegisterWidth (line 150) | ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, ZydisReg...
function ZydisRegister (line 192) | ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, Zy...
function ZydisShortString (line 277) | const ZydisShortString* ZydisRegisterGetStringWrapped(ZydisRegister reg)
function ZydisRegisterWidth (line 290) | ZydisRegisterWidth ZydisRegisterClassGetWidth(ZydisMachineMode mode,
FILE: vendor/zydis/src/SharedData.c
function ZydisGetInstructionDefinition (line 74) | void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, Zy...
function ZyanU8 (line 111) | ZyanU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* defi...
function ZydisGetElementInfo (line 130) | void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementT...
function ZyanBool (line 176) | ZyanBool ZydisGetAccessedFlags(const ZydisInstructionDefinition* definit...
FILE: vendor/zydis/src/String.c
function ZyanStatus (line 69) | ZyanStatus ZydisStringAppendDecU32(ZyanString* string, ZyanU32 value, Zy...
function ZyanStatus (line 113) | ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, Zy...
function ZyanStatus (line 161) | ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, Zy...
function ZyanStatus (line 229) | ZyanStatus ZydisStringAppendHexU64(ZyanString* string, ZyanU64 value, Zy...
function ZyanStatus (line 307) | ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, Zyan...
function ZyanStatus (line 332) | ZyanStatus ZydisStringAppendHexU(ZyanString* string, ZyanU64 value, Zyan...
FILE: vendor/zydis/src/Utils.c
function ZyanStatus (line 41) | ZyanStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instr...
function ZyanStatus (line 119) | ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction* ins...
function ZyanStatus (line 170) | ZyanStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* ...
function ZyanStatus (line 190) | ZyanStatus ZydisGetAccessedFlagsRead(const ZydisDecodedInstruction* inst...
function ZyanStatus (line 203) | ZyanStatus ZydisGetAccessedFlagsWritten(const ZydisDecodedInstruction* i...
function ZyanStatus (line 220) | ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* in...
FILE: vendor/zydis/src/Zydis.c
function ZyanU64 (line 33) | ZyanU64 ZydisGetVersion(void)
function ZyanStatus (line 38) | ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature)
Copy disabled (too large)
Download .json
Condensed preview — 237 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (11,372K chars).
[
{
"path": ".gitignore",
"chars": 6226,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## G"
},
{
"path": "Main.cpp",
"chars": 4383,
"preview": "#include \"VMPImportFixer.hpp\"\n\nbool IsFileArchX64(std::filesystem::path path, bool* parsed = nullptr);\n\ntemplate<size_t "
},
{
"path": "README.md",
"chars": 3188,
"preview": "# VMPImportFixer\n\nVMPImportFixer is a tool aimed to resolve import calls in a VMProtect'd (3.x) binary.\n\n# Information\n\n"
},
{
"path": "VIFTools.cpp",
"chars": 2533,
"preview": "#include \"VMPImportFixer.hpp\"\n\nDWORD VifSearchForProcess(std::string_view process_name) noexcept\n{\n PROCESSENTRY32 pe"
},
{
"path": "VIFTools.hpp",
"chars": 404,
"preview": "#pragma once\n\nstruct VIFModuleInformation_t\n{\n std::string module_path;\n std::uint64_t base_address;\n std::uint"
},
{
"path": "VMPImportFixer.cpp",
"chars": 13312,
"preview": "#include \"VMPImportFixer.hpp\"\n\n\n\nstd::shared_ptr<spdlog::logger> logger;\n\n// Explicit templates.\ntemplate class VMPImpor"
},
{
"path": "VMPImportFixer.hpp",
"chars": 2308,
"preview": "#pragma once\n\n//\n// Emulation engine.\n#include <unicorn/unicorn.h>\n\n#include <Windows.h>\n#include <psapi.h>\n#include <st"
},
{
"path": "VMPImportFixer.sln",
"chars": 1415,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.3132"
},
{
"path": "VMPImportFixer.vcxproj",
"chars": 9981,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msb"
},
{
"path": "VMPImportFixer.vcxproj.filters",
"chars": 4239,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "msc/Process.cpp",
"chars": 2493,
"preview": "#include <Windows.h>\n#include \"Process.hpp\"\n\nusing namespace vif::nt;\n\nProcess::Process(std::uint32_t processId) noexcep"
},
{
"path": "msc/Process.hpp",
"chars": 900,
"preview": "#pragma once\n\n#include <pepp/misc/Address.hpp>\n#include \"ScopedHandle.hpp\"\n#include <pepp/misc/NonCopyable.hpp>\n\nnamespa"
},
{
"path": "msc/ScopedHandle.hpp",
"chars": 734,
"preview": "#pragma once\n\n#include <pepp/misc/NonCopyable.hpp>\n\nnamespace vif::nt\n{\n\tclass ScopedHandle : pepp::msc::NonCopyable\n\t{\n"
},
{
"path": "vendor/pepp/ExportDirectory.cpp",
"chars": 1881,
"preview": "#include \"PELibrary.hpp\"\n\nusing namespace pepp;\n\ntemplate class ExportDirectory<32>;\ntemplate class ExportDirectory<64>;"
},
{
"path": "vendor/pepp/ExportDirectory.hpp",
"chars": 2371,
"preview": "#pragma once\n\n#include <functional>\n\nnamespace pepp\n{\n\tstruct ExportData_t\n\t{\n\t\tstd::string name{};\n\t\tstd::uint32_t rva "
},
{
"path": "vendor/pepp/FileHeader.hpp",
"chars": 1860,
"preview": "#pragma once\n\nnamespace pepp\n{\n\tenum class PEMachine\n\t{\n\t\tMACHINE_I386 = 0x14c,\n\t\tMACHINE_IA64 = 0x200,\n\t\tMACHINE_AMD64 "
},
{
"path": "vendor/pepp/Image.cpp",
"chars": 11533,
"preview": "#include \"PELibrary.hpp\"\n#include \"PEUtil.hpp\"\n#include <algorithm>\n\nusing namespace pepp;\n\n// Explicit templates.\ntempl"
},
{
"path": "vendor/pepp/Image.hpp",
"chars": 6880,
"preview": "#pragma once\n\nnamespace pepp\n{\n\ttemplate<unsigned int>\n\tclass PEHeader;\n\tclass SectionHeader;\n\ttemplate<unsigned int>\n\tc"
},
{
"path": "vendor/pepp/ImportDirectory.cpp",
"chars": 14632,
"preview": "#include \"PELibrary.hpp\"\n\nusing namespace pepp;\n\n\n// Explicit templates.\ntemplate class ImportDirectory<32>;\ntemplate cl"
},
{
"path": "vendor/pepp/ImportDirectory.hpp",
"chars": 2530,
"preview": "#pragma once\n\n#include <string_view>\n#include <functional>\n#include <variant>\n\nnamespace pepp\n{\n\tstruct ModuleImportData"
},
{
"path": "vendor/pepp/OptionalHeader.cpp",
"chars": 2898,
"preview": "#include \"PELibrary.hpp\"\n\nusing namespace pepp;\n\n// Explicit templates.\ntemplate class OptionalHeader<32>;\ntemplate clas"
},
{
"path": "vendor/pepp/OptionalHeader.hpp",
"chars": 3518,
"preview": "#pragma once\n\nnamespace pepp\n{\n\tenum PEDirectoryEntry\n\t{\n\t\tDIRECTORY_ENTRY_EXPORT = 0, // Export Directory\n\t\t"
},
{
"path": "vendor/pepp/PEHeader.cpp",
"chars": 2063,
"preview": "#include \"PELibrary.hpp\"\n\nusing namespace pepp;\n\n// Explicit templates.\ntemplate class PEHeader<32>;\ntemplate class PEHe"
},
{
"path": "vendor/pepp/PEHeader.hpp",
"chars": 4155,
"preview": "#pragma once\n\nnamespace pepp\n{\n\tconstexpr static int MAX_DIRECTORY_COUNT = 16;\n\n\ttemplate<unsigned int>\n\tclass Image;\n\tt"
},
{
"path": "vendor/pepp/PELibrary.hpp",
"chars": 529,
"preview": "#pragma once\n\n#include <Windows.h>\n#include <iostream>\n#include <vector>\n#include <string>\n#include <string_view>\n#inclu"
},
{
"path": "vendor/pepp/PEUtil.cpp",
"chars": 451,
"preview": "#include \"PELibrary.hpp\"\n\n#include <DbgHelp.h>\n#pragma comment(lib, \"dbghelp.lib\")\n\nusing namespace pepp;\n\nstd::string p"
},
{
"path": "vendor/pepp/PEUtil.hpp",
"chars": 691,
"preview": "#pragma once\n\n\nnamespace pepp\n{\n\t//! Windows 32/64bit declare the page size as 4kb (4096)\n\tstatic constexpr std::uint32_"
},
{
"path": "vendor/pepp/RelocationDirectory.cpp",
"chars": 2991,
"preview": "#include \"PELibrary.hpp\"\n\nusing namespace pepp;\n\n// Explicit templates.\ntemplate class RelocationDirectory<32>;\ntemplate"
},
{
"path": "vendor/pepp/RelocationDirectory.hpp",
"chars": 3285,
"preview": "#pragma once\n\nnamespace pepp\n{\n\t/*\n\t* Relocations: research32.blogspot.com/2015/01/base-relocation-table.html\n\t* Format "
},
{
"path": "vendor/pepp/SectionHeader.cpp",
"chars": 2273,
"preview": "#include \"PELibrary.hpp\"\n\nusing namespace pepp;\n\nvoid SectionHeader::SetName(std::string_view name)\n{\n\tstd:memcpy(m_base"
},
{
"path": "vendor/pepp/SectionHeader.hpp",
"chars": 5309,
"preview": "#pragma once\n\nnamespace pepp\n{\n\ttemplate<unsigned int>\n\tclass Image;\n\n\tenum SectionCharacteristics : std::uint32_t\n\t{\n "
},
{
"path": "vendor/pepp/misc/Address.hpp",
"chars": 3712,
"preview": "#pragma once\n\n\n#include \"Concept.hpp\"\n\nnamespace pepp {\n\ttemplate<typename ValueType = std::uintptr_t>\n\tclass Address\n\t{"
},
{
"path": "vendor/pepp/misc/ByteVector.hpp",
"chars": 3849,
"preview": "#pragma once\n\n#include <vector>\n\nnamespace pepp::mem {\n\tclass ByteVector : public std::vector<std::uint8_t>\n\t{\n\tpublic:\n"
},
{
"path": "vendor/pepp/misc/Concept.hpp",
"chars": 220,
"preview": "#pragma once\n\n#include <type_traits>\n\nnamespace pepp::msc\n{\n\ttemplate <class T>\n\tconcept Arithmetic = std::is_arithmetic"
},
{
"path": "vendor/pepp/misc/File.cpp",
"chars": 1343,
"preview": "#include <iostream>\n#include <string>\n#include <fstream>\n#include <filesystem>\n#include <vector>\n#include \"File.hpp\"\n\nna"
},
{
"path": "vendor/pepp/misc/File.hpp",
"chars": 755,
"preview": "#pragma once\n\n#include <fstream>\n\nnamespace pepp::io\n{\n enum FileFlags {\n FILE_INPUT = 1,\n FILE_OUTPUT "
},
{
"path": "vendor/pepp/misc/NonCopyable.hpp",
"chars": 224,
"preview": "#pragma once\n\nnamespace pepp::msc\n{\n class NonCopyable {\n public:\n NonCopyable() = default;\n NonCopy"
},
{
"path": "vendor/spdlog/include/spdlog/async.h",
"chars": 3359,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/async_logger-inl.h",
"chars": 2468,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/async_logger.h",
"chars": 2272,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/cfg/argv.h",
"chars": 1229,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/cfg/env.h",
"chars": 988,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/cfg/helpers-inl.h",
"chars": 3170,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/cfg/helpers.h",
"chars": 710,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/common-inl.h",
"chars": 1918,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/common.h",
"chars": 8330,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/backtracer-inl.h",
"chars": 1880,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/backtracer.h",
"chars": 1136,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/circular_q.h",
"chars": 3434,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/console_globals.h",
"chars": 609,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/file_helper-inl.h",
"chars": 3879,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/file_helper.h",
"chars": 1634,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/fmt_helper.h",
"chars": 3121,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/log_msg-inl.h",
"chars": 1100,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/log_msg.h",
"chars": 1150,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/log_msg_buffer-inl.h",
"chars": 1662,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/log_msg_buffer.h",
"chars": 929,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/mpmc_blocking_q.h",
"chars": 3643,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/null_mutex.h",
"chars": 1026,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/os-inl.h",
"chars": 16036,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/os.h",
"chars": 3744,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/periodic_worker-inl.h",
"chars": 1230,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/periodic_worker.h",
"chars": 1129,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/registry-inl.h",
"chars": 8626,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/registry.h",
"chars": 3648,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/synchronous_factory.h",
"chars": 754,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/tcp_client-windows.h",
"chars": 4673,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/tcp_client.h",
"chars": 3927,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/thread_pool-inl.h",
"chars": 3238,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/thread_pool.h",
"chars": 3263,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/details/windows_include.h",
"chars": 179,
"preview": "#pragma once\n\n#ifndef NOMINMAX\n#define NOMINMAX // prevent windows redefining min/max\n#endif\n\n#ifndef WIN32_LEAN_AND_MEA"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bin_to_hex.h",
"chars": 6295,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/args.h",
"chars": 7467,
"preview": "// Formatting library for C++ - dynamic format arguments\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n// All rig"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/chrono.h",
"chars": 42431,
"preview": "// Formatting library for C++ - chrono support\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n// All rights reserv"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/color.h",
"chars": 24121,
"preview": "// Formatting library for C++ - color support\n//\n// Copyright (c) 2018 - present, Victor Zverovich and fmt contributors\n"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/compile.h",
"chars": 21510,
"preview": "// Formatting library for C++ - experimental format string compilation\n//\n// Copyright (c) 2012 - present, Victor Zverov"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/core.h",
"chars": 98242,
"preview": "// Formatting library for C++ - the core API for char/UTF-8\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n// All "
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/format-inl.h",
"chars": 103928,
"preview": "// Formatting library for C++ - implementation\n//\n// Copyright (c) 2012 - 2016, Victor Zverovich\n// All rights reserved."
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/format.h",
"chars": 103553,
"preview": "/*\n Formatting library for C++\n\n Copyright (c) 2012 - present, Victor Zverovich\n\n Permission is hereby granted, free of "
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/locale.h",
"chars": 100,
"preview": "#include \"xchar.h\"\n#warning fmt/locale.h is deprecated, include fmt/format.h or fmt/xchar.h instead\n"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/os.h",
"chars": 15071,
"preview": "// Formatting library for C++ - optional OS-specific functionality\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/ostream.h",
"chars": 5971,
"preview": "// Formatting library for C++ - std::ostream support\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n// All rights "
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/printf.h",
"chars": 20439,
"preview": "// Formatting library for C++ - legacy printf implementation\n//\n// Copyright (c) 2012 - 2016, Victor Zverovich\n// All ri"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/ranges.h",
"chars": 14444,
"preview": "// Formatting library for C++ - experimental range support\n//\n// Copyright (c) 2012 - present, Victor Zverovich\n// All r"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/bundled/xchar.h",
"chars": 9227,
"preview": "// Formatting library for C++ - optional wchar_t and exotic character support\n//\n// Copyright (c) 2012 - present, Victor"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/chrono.h",
"chars": 396,
"preview": "//\n// Copyright(c) 2016 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/fmt.h",
"chars": 734,
"preview": "//\n// Copyright(c) 2016-2018 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/ostr.h",
"chars": 399,
"preview": "//\n// Copyright(c) 2016 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "vendor/spdlog/include/spdlog/fmt/xchar.h",
"chars": 395,
"preview": "//\n// Copyright(c) 2016 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "vendor/spdlog/include/spdlog/formatter.h",
"chars": 462,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/fwd.h",
"chars": 260,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/logger-inl.h",
"chars": 7010,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/logger.h",
"chars": 12456,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/pattern_formatter-inl.h",
"chars": 42267,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/pattern_formatter.h",
"chars": 3521,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/android_sink.h",
"chars": 3380,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h",
"chars": 4548,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/ansicolor_sink.h",
"chars": 3950,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/base_sink-inl.h",
"chars": 1774,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/base_sink.h",
"chars": 1558,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/basic_file_sink-inl.h",
"chars": 1020,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/basic_file_sink.h",
"chars": 1645,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/daily_file_sink.h",
"chars": 8426,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/dist_sink.h",
"chars": 2410,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/dup_filter_sink.h",
"chars": 3002,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/hourly_file_sink.h",
"chars": 6116,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/mongo_sink.h",
"chars": 3314,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/msvc_sink.h",
"chars": 1124,
"preview": "// Copyright(c) 2016 Alexander Dalshov.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n\n#prag"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/null_sink.h",
"chars": 1229,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/ostream_sink.h",
"chars": 1250,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/ringbuffer_sink.h",
"chars": 2104,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/rotating_file_sink-inl.h",
"chars": 3990,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/rotating_file_sink.h",
"chars": 2444,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/sink-inl.h",
"chars": 721,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/sink.h",
"chars": 887,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h",
"chars": 1211,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/stdout_color_sinks.h",
"chars": 1614,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/stdout_sinks-inl.h",
"chars": 4340,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/stdout_sinks.h",
"chars": 2415,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/syslog_sink.h",
"chars": 3727,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/systemd_sink.h",
"chars": 3422,
"preview": "// Copyright(c) 2019 ZVYAGIN.Alexander@gmail.com\n// Distributed under the MIT License (http://opensource.org/licenses/MI"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/tcp_sink.h",
"chars": 2139,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/win_eventlog_sink.h",
"chars": 8543,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/wincolor_sink-inl.h",
"chars": 6317,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/sinks/wincolor_sink.h",
"chars": 2714,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/spdlog-inl.h",
"chars": 3094,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/spdlog.h",
"chars": 9491,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/stopwatch.h",
"chars": 1654,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/tweakme.h",
"chars": 5689,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/include/spdlog/version.h",
"chars": 330,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/src/async.cpp",
"chars": 488,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/src/cfg.cpp",
"chars": 276,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/src/color_sinks.cpp",
"chars": 2946,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/src/file_sinks.cpp",
"chars": 798,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/src/fmt.cpp",
"chars": 2703,
"preview": "// Slightly modified version of fmt lib's format.cc source file.\n// Copyright (c) 2012 - 2016, Victor Zverovich\n// All r"
},
{
"path": "vendor/spdlog/src/spdlog.cpp",
"chars": 1049,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/spdlog/src/stdout_sinks.cpp",
"chars": 1995,
"preview": "// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.\n// Distributed under the MIT License (http://opensource"
},
{
"path": "vendor/unicorn/include/list.h",
"chars": 741,
"preview": "#ifndef UC_LLIST_H\n#define UC_LLIST_H\n\n#include \"unicorn/platform.h\"\n\nstruct list_item {\n struct list_item *next;\n "
},
{
"path": "vendor/unicorn/include/qemu.h",
"chars": 1098,
"preview": "/* By Dang Hoang Vu <dang.hvu -at- gmail.com>, 2015 */\n\n#ifndef UC_QEMU_H\n#define UC_QEMU_H\n\nstruct uc_struct;\n\n#define "
},
{
"path": "vendor/unicorn/include/uc_priv.h",
"chars": 10209,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015 */\n\n#ifndef UC_PRIV_H\n#define UC_PRIV_H\n\n#"
},
{
"path": "vendor/unicorn/include/unicorn/arm.h",
"chars": 3140,
"preview": "/* Unicorn Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015-2017 */\n/* This file is released under LGPL2.\n Se"
},
{
"path": "vendor/unicorn/include/unicorn/arm64.h",
"chars": 7314,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015-2017 */\n/* This file is released under LGP"
},
{
"path": "vendor/unicorn/include/unicorn/m68k.h",
"chars": 887,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2017 */\n/* This file is released under LGP"
},
{
"path": "vendor/unicorn/include/unicorn/mips.h",
"chars": 5251,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015-2017 */\n/* This file is released under LGP"
},
{
"path": "vendor/unicorn/include/unicorn/platform.h",
"chars": 7444,
"preview": "/* This file is released under LGPL2.\n See COPYING.LGPL2 in root directory for more details\n*/\n\n/*\n This file is to su"
},
{
"path": "vendor/unicorn/include/unicorn/sparc.h",
"chars": 2754,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2017 */\n/* This file is released under LGP"
},
{
"path": "vendor/unicorn/include/unicorn/unicorn.h",
"chars": 27927,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015-2017 */\n/* This file is released under LGP"
},
{
"path": "vendor/unicorn/include/unicorn/x86.h",
"chars": 37881,
"preview": "/* Unicorn Emulator Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015-2017 */\n/* This file is released under LGP"
},
{
"path": "vendor/zycore/include/Zycore/API/Memory.h",
"chars": 5142,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/API/Process.h",
"chars": 2920,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/API/Synchronization.h",
"chars": 5069,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/API/Terminal.h",
"chars": 6784,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/API/Thread.h",
"chars": 8880,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Allocator.h",
"chars": 5189,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/ArgParse.h",
"chars": 6377,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Bitset.h",
"chars": 17512,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Comparison.h",
"chars": 12151,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Defines.h",
"chars": 15849,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Format.h",
"chars": 12147,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/LibC.h",
"chars": 13767,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/List.h",
"chars": 21320,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Object.h",
"chars": 2789,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Status.h",
"chars": 9445,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/String.h",
"chars": 42424,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Types.h",
"chars": 8210,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Vector.h",
"chars": 29541,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/Zycore.h",
"chars": 4146,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/include/Zycore/ZycoreExportConfig.h",
"chars": 926,
"preview": "\n#ifndef ZYCORE_EXPORT_H\n#define ZYCORE_EXPORT_H\n\n#ifdef ZYCORE_STATIC_DEFINE\n# define ZYCORE_EXPORT\n# define ZYCORE_N"
},
{
"path": "vendor/zycore/include/ZycoreExportConfig.h",
"chars": 926,
"preview": "\n#ifndef ZYCORE_EXPORT_H\n#define ZYCORE_EXPORT_H\n\n#ifdef ZYCORE_STATIC_DEFINE\n# define ZYCORE_EXPORT\n# define ZYCORE_N"
},
{
"path": "vendor/zycore/src/API/Memory.c",
"chars": 3947,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/API/Process.c",
"chars": 2785,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/API/Synchronization.c",
"chars": 6758,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/API/Terminal.c",
"chars": 4373,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/API/Thread.c",
"chars": 6852,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/Allocator.c",
"chars": 4463,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/ArgParse.c",
"chars": 10052,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/Bitset.c",
"chars": 19086,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/Format.c",
"chars": 17820,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/List.c",
"chars": 18460,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/String.c",
"chars": 34635,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/Vector.c",
"chars": 25730,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zycore/src/Zycore.c",
"chars": 1840,
"preview": "/***************************************************************************************************\n\n Zyan Core Librar"
},
{
"path": "vendor/zydis/include/Zydis/Decoder.h",
"chars": 8550,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/DecoderTypes.h",
"chars": 47577,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Formatter.h",
"chars": 44988,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/FormatterBuffer.h",
"chars": 10873,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Generated/EnumISAExt.h",
"chars": 2507,
"preview": "/**\n * Defines the `ZydisISAExt` enum.\n */\ntypedef enum ZydisISAExt_\n{\n ZYDIS_ISA_EXT_INVALID,\n ZYDIS_ISA_EXT_ADOX"
},
{
"path": "vendor/zydis/include/Zydis/Generated/EnumISASet.h",
"chars": 5330,
"preview": "/**\n * Defines the `ZydisISASet` enum.\n */\ntypedef enum ZydisISASet_\n{\n ZYDIS_ISA_SET_INVALID,\n ZYDIS_ISA_SET_ADOX"
},
{
"path": "vendor/zydis/include/Zydis/Generated/EnumInstructionCategory.h",
"chars": 3195,
"preview": "/**\n * Defines the `ZydisInstructionCategory` enum.\n */\ntypedef enum ZydisInstructionCategory_\n{\n ZYDIS_CATEGORY_INVA"
},
{
"path": "vendor/zydis/include/Zydis/Generated/EnumMnemonic.h",
"chars": 46643,
"preview": "/**\n * Defines the `ZydisMnemonic` enum.\n */\ntypedef enum ZydisMnemonic_\n{\n ZYDIS_MNEMONIC_INVALID,\n ZYDIS_MNEMONI"
},
{
"path": "vendor/zydis/include/Zydis/Generated/EnumRegister.h",
"chars": 7600,
"preview": "/**\n * Defines the `ZydisRegister` enum.\n */\ntypedef enum ZydisRegister_\n{\n ZYDIS_REGISTER_NONE,\n\n // General purp"
},
{
"path": "vendor/zydis/include/Zydis/Internal/DecoderData.h",
"chars": 10318,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Internal/FormatterATT.h",
"chars": 8388,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Internal/FormatterBase.h",
"chars": 13205,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Internal/FormatterIntel.h",
"chars": 12572,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Internal/SharedData.h",
"chars": 32990,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Internal/String.h",
"chars": 17702,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/MetaInfo.h",
"chars": 3256,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Mnemonic.h",
"chars": 3174,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
},
{
"path": "vendor/zydis/include/Zydis/Register.h",
"chars": 9753,
"preview": "/***************************************************************************************************\n\n Zyan Disassemble"
}
]
// ... and 37 more files (download for full content)
About this extraction
This page contains the full source code of the mike1k/VMPImportFixer GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 237 files (29.3 MB), approximately 2.8M tokens, and a symbol index with 1248 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.