PeOpenFromMemoryCopy
Description
Parse a PE image from an in-memory byte range – R-value / copy form (mirrors VecInsertR).
Parser allocates its own buffer through alloc and MemCopys the caller’s bytes in. Caller’s pointer is never retained.
Success
Returns true; out owns an independent copy of data.
Failure
Returns false; out zeroed; caller’s data untouched.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Pe.c:162:
Pe pe;
bool ok = PeOpenFromMemoryCopy(&pe, blob, sizeof(blob), base);
if (!ok) {
DefaultAllocatorDeinit(&alloc);- In
Pe.c:188:
build_pe_blob();
Pe pe;
if (!PeOpenFromMemoryCopy(&pe, blob, sizeof(blob), base)) {
DefaultAllocatorDeinit(&alloc);
return false;- In
Pe.c:216:
Pe pe;
bool ok = !PeOpenFromMemoryCopy(&pe, garbage, sizeof(garbage), base);
DefaultAllocatorDeinit(&alloc);- In
Pe.c:536:
bool pe_open_from_memory_copy(Pe *out, const u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_FATAL("PeOpenFromMemoryCopy: NULL argument (contract violation)");
}
Buf copy = BufInit(alloc);- In
Pe.c:540:
Buf copy = BufInit(alloc);
if (!BufReserve(©, (u64)data_size)) {
LOG_ERROR("PeOpenFromMemoryCopy: allocation failed ({} bytes)", (u64)data_size);
return false;
}
Last updated on