# libpeconv
**Repository Path**: dot-2/libpeconv
## Basic Information
- **Project Name**: libpeconv
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: BSD-2-Clause
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2020-05-05
- **Last Updated**: 2021-07-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# libpeconv
[](https://ci.appveyor.com/project/hasherezade/libpeconv)
[](https://www.codacy.com/manual/hasherezade/libpeconv?utm_source=github.com&utm_medium=referral&utm_content=hasherezade/libpeconv&utm_campaign=Badge_Grade)
A library to load and manipulate PE files.
### Basic example
*The simplest usecase*: use libPeConv to manually load and run an EXE of you choice.
```C
#include
#include
#include // include libPeConv header
int main(int argc, char *argv[])
{
if (argc < 2) {
std::cout << "Args: " << std::endl;
return 0;
}
LPCSTR pe_path = argv[1];
// manually load the PE file using libPeConv:
size_t v_size = 0;
#ifdef LOAD_FROM_PATH
//if the PE is dropped on the disk, you can load it from the file:
BYTE* my_pe = peconv::load_pe_executable(pe_path, v_size);
#else
size_t bufsize = 0;
BYTE *buffer = peconv::load_file(pe_path, bufsize);
// if the file is NOT dropped on the disk, you can load it directly from a memory buffer:
BYTE* my_pe = peconv::load_pe_executable(buffer, bufsize, v_size);
#endif
if (!my_pe) {
return -1;
}
//calculate the Entry Point of the manually loaded module
DWORD ep_rva = peconv::get_entry_point_rva(my_pe);
if (!ep_rva) {
return -2;
}
ULONG_PTR ep_va = ep_rva + (ULONG_PTR) my_pe;
//assuming that the payload is an EXE file (not DLL) this will be the simplest prototype of the main:
int (*new_main)() = (int(*)())ep_va;
//call the Entry Point of the manually loaded PE:
return new_main();
}
```
### Read more
+ [Docs](https://hasherezade.github.io/libpeconv/)
+ [Examples](https://github.com/hasherezade/libpeconv/tree/master/tests)
+ [Tutorials](https://hshrzd.wordpress.com/tag/libpeconv/)
+ [Project template](https://github.com/hasherezade/libpeconv_project_template)