PeFileOpenFromMemory
Description
Parse a PE image from an in-memory byte range. The data buffer is borrowed – the caller must keep it alive for the lifetime of the returned PeFile.
Success
Returns true; out->owns_data is false.
Failure
Returns false; logs the failing step. out is left zeroed.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Pe.c:161:
PeFile pe;
bool ok = PeFileOpenFromMemory(&pe, blob, sizeof(blob), base);
if (!ok) {
DefaultAllocatorDeinit(&alloc);- In
Pe.c:187:
build_pe_blob();
PeFile pe;
if (!PeFileOpenFromMemory(&pe, blob, sizeof(blob), base)) {
DefaultAllocatorDeinit(&alloc);
return false;- In
Pe.c:215:
PeFile pe;
bool ok = !PeFileOpenFromMemory(&pe, garbage, sizeof(garbage), base);
DefaultAllocatorDeinit(&alloc);- In
Pe.c:381:
// ---------------------------------------------------------------------------
bool PeFileOpenFromMemory(PeFile *out, u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_ERROR("PeFileOpenFromMemory: NULL argument");- In
Pe.c:383:
bool PeFileOpenFromMemory(PeFile *out, u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_ERROR("PeFileOpenFromMemory: NULL argument");
return false;
}- In
Pe.c:429:
return false;
}
if (!PeFileOpenFromMemory(out, (u8 *)buf, (size)bytes, alloc)) {
AllocatorFree(alloc, buf, capacity);
return false;
Last updated on