validation
flavor.psp.format_2025.pe_utils.validation
¶
PE executable validation utilities.
Provides functions to validate and analyze Windows PE (Portable Executable) files.
Functions¶
get_pe_header_offset
¶
Read the PE header offset from the DOS header.
The offset is stored at position 0x3C (e_lfanew field) as a 4-byte little-endian integer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
PE executable data |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
PE header offset, or None if invalid |
Source code in flavor/psp/format_2025/pe_utils/validation.py
is_pe_executable
¶
needs_dos_stub_expansion
¶
Check if a PE executable needs DOS stub expansion.
Go binaries use minimal DOS stub (128 bytes / 0x80) which is incompatible with Windows PE loader when PSPF data is appended. This function detects such binaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
PE executable data |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if DOS stub needs expansion (Go binary with 0x80 stub) |