A header-only library for proxying DLLs with one function call:
- 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!)
A simple DLL with a DllMain looking like this:
Is all that is needed, the DLL is then proxied properly (dxgi.dll was proxied in this example):
Note: The debug terminal is optional.
You can then create a new thread and do the usual proxy DLL stuff:
You may add callbacks to exported functions (dinput8.dll was used in this example):
Your callback will be called when the exported function is called (directly prior to it).
Note: You'll have to 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.
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
Note: 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 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 create a "<dll>_export_list.txt" file in the script folder:
Copy the contents of the generated file to somewhere at the bottom of "UniversalProxyDLL.h" and build:
The DLL should now be proxied correctly.
However if your DLL has more exports than the current amount of Forward and ForwardOrdinal functions, you must also use the scripts "create_export_ordinals.py" and "create_forward_functions.py" to generate an amount of functions equal to the number of exports of your DLL.
Note: some system DLLs such as user32 may refuse to be proxied!
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:
Some of my other projects, such as DirectXHook and Elden Mod Loader.
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.