Version 0.2.0
Dynamic Link Shim
Dynamic Link Shim is a small Zig tool for building DLL proxies.
DLS takes an existing Windows DLL, generates a replacement DLL with the same exports, forwards those exports to the original DLL, and loads the DLLs you configure when the host process starts.
Quick Start
Pick a DLL that something already loads, then tell DLS what companion DLLs to load:
zig build -- --input Library.dll --load Patch.dllDLS reads exports from Library.dll, generates a proxy named Library.dll, forwards the original exports to the backing DLL, and loads Patch.dll when the proxy starts.
For an install-style folder:
zig build -- --input C:\Game\Library.dll --load Patch.dll --copy-to-input-dirExample layout after install:
Library.dll <- generated proxy
Library.og.dll <- original backing DLL
Patch.dll <- DLL loaded by the proxy
Configuration
DLS reads config.zon beside build.zig by default.
Common fields:
input: DLL to read exports fromforward_to: original DLL the proxy forwards tooutput: generated proxy DLL namebackend:runtime_stubby default, orpe_forwarderload: DLLs loaded by the proxy
Override the backend:
zig build -Dbackend=runtime_stub
zig build -Dbackend=pe_forwarderBackends
runtime_stub is the default backend. It builds a normal DLL with real exported stubs, loads configured DLLs with LoadLibraryW, loads the backing DLL with LoadLibraryW, resolves exports with GetProcAddress, then jumps to the resolved export.
pe_forwarder emits a tiny PE forwarder DLL directly. This mirrors the reference forwarder style, where companion DLLs are loaded through the PE import table and exports are represented as PE export forwarders.
Building
Use Zig 0.16.0.
zig buildThe default build uses ReleaseSmall and writes the configured proxy to:
./zig-out/bin/Inspect the configured export map without building the proxy:
zig build inspectDisclaimer
Using with with some software may violate their ToS. Use it at your own risk.
Changelog
- Add output-pair build mode
See a full diff here