#Help with DLL Injection

12 messages · Page 1 of 1 (latest)

hybrid osprey
#

I'm currently trying to modify an old strategy game so that it's online functionality (based on GameSpy) is fully functional again. Therefore i wrote a small DLL that redirects the gamespy DNS queries to servers that the community maintains. I already confirmed that the DLL does what i want using the Xenos Injector and Wireshark. (Source can be found here: https://github.com/DarkAtra/bfme2-patcher/tree/fb7c6b66b505a853e72ad0d9122b74da3b0de681/game-patcher)

The next step for me was to add injection functionalities to my game launcher so that me and my friends wouldn't have to inject the dll manually every time we wanted to play. The game launcher is a fairly old project of mine and was written entirely in Kotlin. I opted to using JNA so that i would have access to OpenProcess, VirtualAllocEx and all the other function that i needed.

So far, i've manged to allocate memory in the game process, write the DLL path to the allocated memory and create a remote thread which should in theory load the dll using LoadLibrary. However, the DLL is not loaded and the thread just dies instantly. (Source can be found here: https://github.com/DarkAtra/bfme2-patcher/blob/fb7c6b66b505a853e72ad0d9122b74da3b0de681/updater/src/main/kotlin/de/darkatra/bfme2/util/InjectionUtils.kt)

What would be the best way to debug this?

spark heraldBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

scarlet topaz
#

please read the rules of the server. We will not help you write hacks for a game

hybrid osprey
#

i wouldn't consider this a hack, but it's 100% okay for me if that's still considered against the rules. i know this is a fine line to walk on

scarlet topaz
#

you can open up a thread with modmail in #rules to see if you can ask for help in your case, but the rule is pretty clear about game hacks

#

I have absolutely no say in this at all, but based on the post, that should be fiine?

hybrid osprey
#

i'll try the modmail route ^^

nova dagger
#

@hybrid osprey We don't help with modding as it is indistinguishable from cheating and other nefarious activity.

hybrid osprey
#

gotcha

flint mulch
#

Why are you creating your thread in suspended state?

#

I'd go with using the loadlibrary export name instead of using the ordinal

#

Also be careful with LoadLibraryA vs LoadLibraryW, the latter expects wide characters, so make sure that's what you are copying into your allocated memory