Skip to content

techiew/UltimateProxyDLL

Repository files navigation

Universal Proxy DLL

A header-only library for proxying DLLs with one function call:

One function call pic

Features:

  • No .masm or .def files required
  • No project configuration required
  • Built DLL can dynamically proxy any supported DLL without rebuilding (just rename the DLL)
  • Set callbacks for exported functions
  • No race conditions (exported functions will wait for proxy creation)
  • No LoadLibrary calls within DllMain
  • Works for 32-bit and 64-bit games (32-bit has limited support!)

Example

A simple DLL with a DllMain looking like this:

DllMain example pic

Is all that is needed, the DLL is then proxied properly (dxgi.dll was used in this example):

Proxy example pic

Note: The debug terminal is optional of course.

You can then create a new thread and do the usual proxy DLL stuff:

Usual proxy stuff pic

Callback example

Adding a callback for one of the exported functions (dinput8.dll was used in this example):

Callback example pic

Your function will be called when the exported function is called (directly prior to it).

You'll have to know and specify the correct function signature in the same manner as shown in the example. For instance, the function signature for "DirectInput8Create" used in the example was found here.

Supported DLLs

Yes, technically this is not universal, only on paper. See section "Adding support for a DLL".

The most common proxy DLLs are supported out of the box:

  • dxgi
  • d3d10
  • d3d11
  • d3d12 (see issue #1)
  • dinput8
  • XInput1_3
  • XInput1_4
  • steam_api64
  • steam_api
  • opengl32
  • winhttp
  • bink2w64

I do not guarantee that all supported DLLs will work for 32-bit games. Trial and error is required in this case.

Adding support for a DLL

Adding support for a DLL is simple. In the "scripts" folder you will find some Python scripts.

Use the "create_export_list.py" script by running python create_export_list.py <path_to_dll>. This will generate a "<dll>_export_list.txt" file in the script folder:

create_export_list pic

Copy the contents of the generated file to the bottom of "UniversalProxyDLL.h" and build:

New exports pic

The DLL should now be proxied correctly.

Note: some system DLLs such as user32 may refuse to be proxied!

Checking which DLLs a game loads

To check which DLLs you can use to create proxies for specific games, you may for example use the "dumpbin" tool provided with Visual Studio:

Dumpbin pic

Used in...

Some of my other projects, such as DirectXHook and Elden Mod Loader.

Contributions

If you find that a DLL is not supported and you've added the exports yourself, I'd appreciate if you'd create a PR so the exports can be made available to others. Thank you.

License

LICENSE.md