I'm not sure that this is the right SO community to be asking this in, but I thought I'd give it a try. Some friends and I have successfully detoured a game built with UE4 by loading a modified xinput_3.dll. The annoyance is now that types from functions we detour need to be recreated in some method. Up until now, my friends have just been disassembling and recreating on our side of the fence. I had the idea to just compile using the UE4 headers since they're publicly available. I've finagled my way into being able to include their files, but trying to use anything results in unresolved symbols.

Everything is marked __declspec(dllimport) so evidently I need to be linking against something.

Is it possible to link against the game exe to obtain these imports since UE4 is statically linked into it? Alternatively (though all my research suggests not), can UE4 be built into a dll?

  • 1
    If the things you want are marked dllimport then they're likely already in one of the DLLs with the game not the main .exe. If you can find which one, you can build a .lib from it to link against. Or if you just want an implementation of the method you can always copying the bits of code you need from the UE4 source as well as the headers.
    – Rup
    Mar 31 '19 at 8:41
  • 1
    If you did want to call into functions in the .exe then that would be possible too but difficult: assuming it's not exported, you'd need to find the address yourself, and then either hope there's no relocation at load time or handle it yourself: check the base address of the process and compensate for that as you make the call into the function. And then update the function pointer when the game updates, etc. But in that case it would probably be easier to just decompile the code in the game using the UE4 source as reference, just in case there are any customisations there.
    – Rup
    Mar 31 '19 at 8:44
  • @Rup I think UE4 forces the engine to be statically linked in. If I could find a UE4 dll I'd be set. forums.unrealengine.com/development-discussion/…
    – Braaedy
    Mar 31 '19 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.