Commit Graph

208 Commits

Author SHA1 Message Date
dmex 66e276b763 Improve phlib API compatibility and utilities
This change updates phlib with broader native API compatibility shims, new CRC32/CRC32C tables, and safer utility helpers. It also fixes a number of synchronization, formatting, environment, and process-creation edge cases, adds correlation-vector support, hardens SID conversion and image-resource loading, and cleans up several Windows compatibility fixes across the library.
2026-09-30 00:45:00 +10:00
Johnny Shaw 2755b14423 phlib fix doxygen 2026-09-09 23:22:15 -06:00
Johnny Shaw bb171fa2c0 phlib require an export name to end inside the view before handing it out 2026-09-09 22:54:20 -06:00
Johnny Shaw 62ae4eac21 phlib bound a data directory by the header instead of refusing the image 2026-09-09 22:39:30 -06:00
Johnny Shaw 79331f0e7c phlib probe the magic that decides which optional header this is 2026-09-09 22:39:10 -06:00
Johnny Shaw 4955bcf426 Trim the commentary the security pass left behind 2026-09-09 21:45:18 -06:00
Johnny Shaw 80ec19780a phlib report the debug entries that were read, not the ones claimed 2026-09-09 20:44:16 -06:00
Johnny Shaw 0e49cb927a phlib bound an export name comparison to the mapped view 2026-09-09 20:34:13 -06:00
Johnny Shaw 28e8e94bf3 phlib bound a resource to the view before handing it back 2026-09-09 20:29:18 -06:00
Johnny Shaw d39faac1d6 phlib require an optional header to hold the fields its magic implies 2026-09-09 20:07:36 -06:00
Johnny Shaw 3a452ab2cd mapimg bdd max depth 2026-07-30 22:17:58 -06:00
Johnny Shaw b5313f29c1 mapimg bdd parser fixes 2026-07-30 21:01:03 -06:00
Johnny Shaw c47710ea79 mapimg bdd parser update 2026-07-30 21:01:01 -06:00
Johnny Shaw 3ef1b81f1b mapimg bdd tree parsing fix 2026-07-30 21:00:56 -06:00
Johnny Shaw 6d11476a35 mapimg bdd tree parsing 2026-07-30 21:00:53 -06:00
dmex 31d39baf13 Improve mapped image resource parsing 2026-07-14 02:59:22 +10:00
dmex 8572cfe749 Fix peview failing to show CFG #2966 2026-07-06 18:55:49 +10:00
dmex 15ec45a121 Update copyright year 2026-07-01 01:43:30 +10:00
dmex ca6af0ea2d Refactor UI buffering and propsheet behavior 2026-06-27 17:00:05 +10:00
dmex a505af0969 Enhance miniinfo graphs & zombie process handles 2026-06-15 12:56:06 +10:00
dmex 0b2104b7ed Multiple fixes, typos and enhancements 2026-05-18 13:22:48 +10:00
dmex 0c8e67508e Update verbose script and doxygen comments 2026-04-21 02:34:19 +10:00
dmex 24aa5740f3 Init checksum and expand checksum comment 2026-04-20 15:15:32 +10:00
dmex 099371f83c Fix sizeof usage and cleanup on error paths 2026-04-13 04:10:44 +10:00
dmex 1fa6dbed4c Improve Rich header parsing and checksum validation
Improve Rich header validation/robustness:
- Simplified/decrypted rich header loop and compute buffer end pointer; use PhMappedImageProbe and SEH to guard mapped memory accesses.
- Validate richHeaderLength alignment to PRODITEM size and derive entry count from length instead of scanning.
- Reworked hash handling to use a length variable returned by PhFinalHash and pass the actual hash length to PhBufferToHexString.
- Replace ProdIdHeader number/count assignment to use the finalized entry array count/items.
- Implement full Rich checksum computation (DOS header + entries) with rotations and per-entry contribution, validate against stored key and return STATUS_INVALID_IMAGE_HASH on mismatch.
- Make Rich total-length vs NT headers offset non-fatal (keep an assert in DEBUG builds) and fall back to NT headers offset as boundary.
- Minor bounds-check and formatting fixes in dynamic relocations and other hash output conversions.
These changes improve safety against malformed or tampered PE Rich headers and reduce crash potential when parsing mapped images.
2026-04-05 21:05:51 +10:00
dmex 4df243b093 Update mapimg.c 2026-04-05 21:00:49 +10:00
dmex 6c77c880f0 Rename GuardAdressIat -> GuardAddressIat 2026-03-25 01:24:19 +11:00
dmex bae2ca3b41 Update comments and tidy up 2026-03-22 11:31:16 +11:00
dmex 630d08ee80 Update mapimg.c 2026-02-21 13:08:16 +11:00
dmex 08a54568c5 Add PhLoadMappedImageHeaderFromFile, PhLoadMappedImageNoExecute, DynamicRelocations v2 and RF Guard relocation support 2026-02-21 10:39:39 +11:00
dmex 869df66a0e Update mapimg.c 2026-01-09 10:41:13 +11:00
dmex bd9effd7b0 Update documentation and types 2025-12-12 19:42:59 +11:00
dmex 8dfb01aecb Add PhReadVirtualMemory and PhInitializeRemoteMappedImage 2025-09-20 08:52:00 +10:00
Ren 54a8bbdef9 Better POGO parsing (#2691) 2025-09-20 03:22:43 +10:00
dmex 5423ff7cfb Merge dev branch fixes (#2680) 2025-09-07 05:06:34 +10:00
zjgcjy 0b96cfd122 fix: wrong condition in dvrt import control (#2675) 2025-09-03 22:21:02 -06:00
Johnny Shaw b9c52e9dd1 peview manifest tab 2025-07-02 21:24:51 -06:00
dmex d7a9a5f43b Return extra status info for PE prodid 2025-06-18 03:18:28 +10:00
Johnny Shaw 1db4e3012d fix PhMapViewOfSection 2025-05-31 19:46:23 -06:00
dmex 3f55a60c98 re-organized phlib 2025-05-22 07:48:42 +10:00
M b75c6ec934 Fix the bitness of the dynamic relocations for 32-bit (#2493) 2025-04-05 10:31:35 +11:00
dmex e33f65dc4f Update SAL annotations and status consistency 2025-03-26 20:27:26 +11:00
dmex 2ad114fb40 Move PhMappedImageEnumerateRelocations probes 2025-03-22 14:22:44 +11:00
dmex ac2ed17cff Add initial cmake support and fix compatibility issues 2025-02-28 12:18:01 +11:00
dmex 0affd41233 Update PPH_STRINGREF to PCPH_STRINGREF 2025-02-25 17:24:27 +11:00
dmex 51baa8da89 Add ReadVirtualMemoryCallback 2025-02-12 19:29:10 +11:00
dmex d37f9f9683 Add PhMappedImageSectionByName 2025-02-11 16:10:50 +11:00
dmex 2d1d1fb355 Update attributes and types 2025-02-11 16:10:35 +11:00
Johnny Shaw 304b7dbf05 mapimg fix relocation block parsing 2025-01-04 20:34:29 -07:00
ge0rdi 9cd715578d fix beyond-buffer access in PhGetRemoteMappedImageGuardFlagsEx (#2357)
Some images (GOG GalaxyClient.exe) have LoadConfig directory smaller than size
provided inside `IMAGE_LOAD_CONFIG_DIRECTORY` structure.

We need to make sure to to access only valid part of buffer returned by
`PhGetRemoteMappedImageDirectoryEntry`.

Found using ApplicationVerifier.
2025-01-02 21:51:11 -07:00