Skip to content

fix(blob): resolve ordinal imports for named IAT hooks - #4

Merged
hzqst merged 1 commit into
mainfrom
fix/blob-ordinal-import-hooks
Oct 6, 2026
Merged

hzqst merged 1 commit into
mainfrom
fix/blob-ordinal-import-hooks

Conversation

@hzqst

@hzqst hzqst commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

BLOB imports loaded by ordinal were resolved into the IAT but omitted from the import registry. As a result, BlobHasImportEx(blob, "wsock32.dll", "select") and BlobIATHook could not find select in old GoldSrc engines, and BlobHasImport could miss a DLL imported only by ordinal.

Record both named and ordinal imports together with their original resolved export address. For ordinal entries, resolve the requested function name against the same DLL and compare it with the retained address. Matching continues to work after another hook has overwritten the IAT slot. Named-import matching retains its existing behavior; no hardcoded ordinal or public API change is needed.

Adds a regression test using the real BLOB loader, an encrypted in-memory fixture, and real Win32 named/ordinal exports. Only unused host services and the hook allocation sink are stubbed. It covers ordinal-only DLL discovery, named lookup, the selected IAT slot, misses, lookup after hooking, restoration, and the existing named-import path.

Validation:

  • The regression failed at ordinal-only DLL discovery before the loader fix and passed afterward.
  • Win32 Debug and Release CTest: 2/2 passed in each configuration.
  • Full Debug and Release builds of both MetaHook and MetaHook_blob passed.
  • HL 3266 BLOB live verification with the patched launcher and ThreadGuard: the named select hook installed, the network worker exited cooperatively before resource cleanup, and the process returned 0. Temporary game files/configuration were restored.
  • git diff --check passed.

Completes the BLOB loader dependency documented in MetaHookSv/ThreadGuard#5, for MetaHookSv/ThreadGuard#4. This launcher fix must be shipped for that plugin's BLOB support.

Co-Authored-By: Codex <codex@openai.com>
@hzqst
hzqst merged commit c2281f6 into main Oct 6, 2026
@hzqst
hzqst deleted the fix/blob-ordinal-import-hooks branch October 7, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant