I am developing a DLL for a game. And sometimes I encounter errors, but to find these errors, I have to spend a lot of time searching in my code. The DLL is launched through an injector program that implements the DLL into the game process. What is the most convenient way to debug a DLL in my case?
CodePudding user response:
You're on the right path by following the steps in this document.
What you need is to launch the game from the debugger, by setting it as the command line as shown in the document. Note that this won't work for all games since games typically have some kind of anti-debugger protection.
After launching the game and attaching the debugger, start your injector separately to inject your DLL into the game. Your injector should not use manual mapping or other techniques that hide or strip information from your DLL, I recommend using the good old LoadLibrary
method.
For convenience, use Debug multiple processes to start the injector with the game and not have to run it manually.
If the steps described above didn't work due to the game protection, the last option is to use Cheat Engine to debug in assembly.