Skip to content

Version 0.2.0

Choose a tag to compare

@DynamiByte DynamiByte released this 12 May 01:13
· 23 commits to main since this release

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.

Version
License

Quick Start

Pick a DLL that something already loads, then tell DLS what companion DLLs to load:

zig build -- --input Library.dll --load Patch.dll

DLS 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-dir

Example 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 from
  • forward_to: original DLL the proxy forwards to
  • output: generated proxy DLL name
  • backend: runtime_stub by default, or pe_forwarder
  • load: DLLs loaded by the proxy

Override the backend:

zig build -Dbackend=runtime_stub
zig build -Dbackend=pe_forwarder

Backends

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 build

The default build uses ReleaseSmall and writes the configured proxy to:

./zig-out/bin/

Inspect the configured export map without building the proxy:

zig build inspect

Disclaimer

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