libPeConv for Manual PE Loading and Unmapping
A library to load, manipulate, dump PE files. See also: https://github.com/hasherezade/libpeconv_tpl
At a glance
- What is it?
- libPeConv is a Windows C++ library for custom PE loading, import handling, memory dumping, and IAT reconstruction. It is aimed at developers building PE loaders, binders, or analysis tooling rather than users seeking a general-purpose executable loader.
- Who is it for?
- Adopt libPeConv when a Windows C++ tool needs explicit control over PE remapping, imports, resources, delayed imports, or memory reconstruction. Do not choose it for inline hooking, MUI applications, or teams that need documented package installation and release artifacts.
- Can I use it commercially?
- Yes. BSD-2-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Activity is slowing. The repository last received commits 6 months ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Where libPeConv Fits in a Custom Windows Loader
libPeConv addresses a specific Windows engineering problem: a PE image exists as a file or memory buffer, but the application needs to load and manipulate it without treating it as an ordinary local module. Its documented helper set covers section remapping, relocation processing, import loading, delayed imports, resource parsing, entry-point lookup, TLS callbacks, IAT rebuilding, and PE dumping. That makes it relevant to developers assembling PE binders, custom loaders, converters, and reverse-engineering utilities.
The target user is a C++ developer who already understands the PE format and needs access to individual loading stages. The README does not present libPeConv as an application with a command-line interface or as a transparent replacement for the Windows loader. Its basic example passes a mapped image to `get_entry_point_rva`, calculates an address from the returned RVA and mapped base, then calls that address as a function. This is low-level control with explicit assumptions, not a general-purpose launch service.
The project also has a deliberate boundary around hooking. It supports customization such as IAT hooking through custom IAT resolvers and function redirection, but the README explicitly excludes inline hooking. It should not be compared directly with MS Detours or MinHook, whose stated purpose is inline hooking. The repository is not archived, and its last push was on 2026-04-18. That date is the only maintenance fact established here; the repository has no GitHub releases, so there is no release cadence to infer from release metadata.
The Mapping, Initialization, and Execution Sequence
The documented flow begins by obtaining PE bytes and passing them to `load_pe_executable`. The API has separate documented paths for a file on disk and a file already held in a memory buffer. The return value is a mapped image, while an output parameter supplies the mapped virtual size. This distinction matters for tools that receive packed, embedded, or otherwise file-backed data and cannot assume a conventional executable path.
After mapping, the example optionally connects the image to the process environment through `set_main_module_in_peb`. That matters only when the loaded PE accesses resources, according to the README. The library then handles delayed imports with `load_delayed_imports`, passing both the image and its load base. If desired, `run_tls_callbacks` is called before normal entry-point execution. Separating TLS callbacks from the entry point preserves the documented PE startup sequence rather than jumping directly to program code.
The entry point is resolved with `get_entry_point_rva`, converted to a virtual address using the mapped base, and cast to a callable function. The example assumes the payload is an EXE rather than a DLL. This assumption is a real constraint for reuse: a library-oriented DLL may need different export-oriented handling, while an EXE may require a compatible calling convention and startup environment. The README example is a basic prototype, not a complete account of exception setup, permissions, dependency behavior, cleanup, or all PE edge cases.
Building libPeConv and Preparing a First Manual Load
The README does not document a package-manager installation, a binary download, or a complete build command. It links to the project documentation, a `project_template`, and tests, while the repository layout includes `CMakeLists.txt`, `.appveyor.yml`, and the `libpeconv/` source directory. Based on that layout, `CMakeLists.txt` is the build definition to inspect first. No versioned dependency command or platform-specific compiler setting is provided, so this article does not invent one.
The following is the opening of the README's basic example. It includes the Windows API, standard I/O stream support, and libPeConv's public header, then checks for the executable path argument:
#include <Windows.h>
#include <iostream>
#include <peconv.h> // include libPeConv header
int main(int argc, char *argv[])
{
if (argc < 2) {
std::cout << "Args: <path to the exe>" << std::endl;
return 0;
}
LPCSTR pe_path = argv[1];A reader building the full example should provide the compiled binary with one PE path. Without an argument, the documented program prints `Args: <path to the exe>` and exits. The remainder of the example chooses either `load_pe_executable(pe_path, v_size)` under `LOAD_FROM_PATH`, or it reads the file with `load_file` and maps the resulting buffer. The compile-time switch must be selected by the integrator because the README does not state which project setting defines `LOAD_FROM_PATH`.
Calling the Rebuilt Entry Point Safely
The README treats entry-point execution as the final step after mapping and selected initialization. Once `load_pe_executable` returns a non-null image, the example can resolve delayed imports and run TLS callbacks before calculating the entry point. The following documented block shows the mapping failure check and the resource-related PEB setup:
if (!my_pe) {
return -1;
}
// if the loaded PE needs to access resources, you may need to connect it to the PEB:
peconv::set_main_module_in_peb((HMODULE)my_pe);The null check is the clearest first-use boundary: without a mapped image, the example stops before calling entry-point logic. The PEB step is conditional in purpose, although the shown example performs it whenever loading succeeds. If the image needs resources, omitting this step can leave resource lookup without the expected process environment. If it does not need resources, the README does not establish that this operation is required.
The rest of the example invokes `load_delayed_imports`, optionally invokes `run_tls_callbacks`, and obtains `ep_rva` with `get_entry_point_rva`. A zero return value produces the documented `-2` failure exit. Otherwise, it adds the RVA to the mapped image address and calls the result as `int (*new_main)()`. Integrators should treat this as an EXE-specific prototype. The README does not document unloading, rollback, exception policy, command-line conventions for a packaged `run_pe` utility, or behavior for malformed images.
Imports, Resources, Dumping, and IAT Reconstruction
Beyond the short execution example, libPeConv is organized around stages that can be useful to a custom PE tool. Import loading allows an embedded PE to resolve dependencies after mapping. Custom IAT resolvers and function redirection provide controlled substitution at the import-table level. Delayed-import handling addresses imports resolved later than ordinary startup. Resource parsing supports tools that need to inspect or manipulate PE resources, while `set_main_module_in_peb` connects the mapped image to the PEB when resource access requires it.
The unmapper and dumping direction is separate from the loader path but part of the same broader problem. The README says libPeConv can dump PEs from memory and rebuild their IATs. Based on the repository entries, `pe_unmapper/` and `run_pe/` are concrete areas of the codebase, while `tests/` contains examples and tests linked by the README. The documentation does not describe the exact API sequence for dumping or the conditions under which an IAT can be reconstructed, so an integrator should consult the generated documentation and tests before assuming a complete round trip.
This stage separation is the main design choice. A tool can customize resolution instead of accepting one fixed loading policy, but it must coordinate the order of mapping, imports, TLS, entry-point execution, and memory reconstruction. Incorrect ordering or an incomplete process environment can produce failures that are specific to the target PE. The project is therefore closer to reusable PE-processing components than to a high-level loader with a single `LoadLibrary` replacement.
MUI, Hooking Scope, and Integration Boundaries
The clearest documented incompatibility is MUI. The README warns that applications using MUI are not supported and links to issue 44. A prospective adopter should therefore reject libPeConv as a general solution if the target depends on MUI behavior, or establish that the specific image avoids the unsupported path before integrating it. The documentation does not describe a workaround, a supported version range, or a test matrix that would remove this uncertainty.
The second boundary concerns hooking. IAT hooking and function redirection are in scope because libPeConv exposes custom IAT resolution points. Inline hooking is out of scope by the README's own warning. This distinction affects project selection: a developer who needs import-table substitution can find relevant helpers here, while a developer whose requirement is instruction-level interception must choose tooling built for that mechanism. Naming MS Detours or MinHook does not make either library a drop-in alternative, because their documented inline-hooking focus differs from libPeConv's loader and manipulation scope.
The BSD-2-Clause license is permissive and allows use under its terms, but this review does not interpret legal obligations or compatibility for a particular distribution. The repository has no GitHub releases, so adoption decisions should not rely on a claimed stable release stream. The last push was on 2026-04-18, while the build configuration and project template are the concrete sources available for evaluating integration effort.
Editorial conclusion
Adopt libPeConv when a Windows C++ tool needs explicit control over PE remapping, imports, resources, delayed imports, or memory reconstruction. Do not choose it for inline hooking, MUI applications, or teams that need documented package installation and release artifacts. Verify first that the intended PE workflow is supported, especially when resources or the PEB are involved, and review the build files under `CMakeLists.txt` before integration.
Frequently asked questions
What does libPeConv do?
It is a C++ library for loading and manipulating Windows PE files. Its documented helpers cover remapping sections, applying relocations, loading imports and delayed imports, parsing resources, running TLS callbacks, dumping PEs from memory, and rebuilding IATs.
Does libPeConv support inline hooking?
No. The README says the project is not focused on inline hooking and should not be confused with MS Detours or MinHook. It does support customization such as IAT hooking through custom IAT resolvers and function redirection.
How do I install libPeConv?
The README does not provide a package-manager command or documented binary installation procedure. It links to the documentation and a project template, and the repository includes `CMakeLists.txt`; the build configuration is therefore the place to inspect for integration details.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/hasherezade-libpeconv)Was this useful?