Skip to content

Load a hooked copy of steamclient64.dll (diversion) + startup hardening - #5

Open
xib031 wants to merge 1 commit into
madoiscool:mainfrom
xib031:feat/diversion
Open

xib031 wants to merge 1 commit into
madoiscool:mainfrom
xib031:feat/diversion

Conversation

@xib031

@xib031 xib031 commented Oct 13, 2026

Copy link
Copy Markdown

Startup change, split from the ticket work so it can be reviewed on its own.

What it does

  • steamclient64.dll is copied to \bin\diversion64.dll (size + mtime staleness check, 3 retries); the copy is loaded as the client module and hooked, so the original module stays untouched in memory
  • GetModuleHandleA/W/ExA/ExW are redirected to the copy for Steam client DLL names, and SteamUI's LoadModuleWithPath is intercepted with a bounded wait for hook installation; any failure falls back to the original module ("Diversion inactive")
  • the module is pinned against FreeLibrary; detour cleanup is skipped during process termination
  • RemoteToml: cache writes are atomic (PID temp file + MoveFileExW); paths resolve as UTF-8; the fetch order stays remote-first, cache is the fallback
  • CloudRedirectHost: lookup order next to the DLL / next to the config / Steam root, error-code-safe checks, function pointers nulled on shutdown

Scope and risk

The GetModuleHandle* redirects are process-wide: every caller asking for the Steam client DLL gets the diversion copy while it is the loaded client module. That blast radius is exactly why this is separated from the ticket change. The failure path is covered: if the copy or load fails, the original module is loaded and the log says so.

Provenance: the diversion approach follows upstream OpenSteamTool PR OpenSteam001#193 (BSD-3-Clause).

Verification

  • built Release and Debug from this branch; exports unchanged

- copy steamclient64.dll to bin\diversion64.dll and hook the copy so the
  original module stays untouched in memory
- redirect module lookups and SteamUI's LoadModuleWithPath to the copy,
  with an automatic fallback to the original module on any failure
- pin the module and skip cleanup during process termination
- write the metadata cache atomically and resolve paths as UTF-8
- fix CloudRedirect library lookup and shutdown bookkeeping

The diversion approach follows upstream OpenSteamTool PR OpenSteam001#193 (BSD-3-Clause).
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