PeOpen
Description
Open and parse a PE file from disk.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Populated on success. |
path |
in | Filesystem path. Str * preferred; const char * accepted. |
alloc |
in | Allocator for the read-in buffer and the sections vector. Must outlive the Pe. |
Success
Returns true; out owns the read-in buffer.
Failure
Returns false; logs the failing step. out is left zeroed.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
PdbCache.c:100:
static bool entry_open(PdbCacheEntry *entry, Allocator *alloc) {
if (!entry->pe_open) {
if (!PeOpen(&entry->pe, entry->module_path.data, alloc))
return false;
entry->pe_open = true;- In
Pe.c:550:
bool pe_open(Pe *out, Zstr path, Allocator *alloc) {
if (!out || !path || !alloc) {
LOG_FATAL("PeOpen: NULL argument (contract violation)");
}
Buf data = BufInit(alloc);- In
Pe.c:555:
if (FileReadAndClose(path, &data) < 0) {
BufDeinit(&data);
LOG_ERROR("PeOpen: failed to read {}", path);
return false;
}
Last updated on