How to debug a dll using visual studio?

Leonardo 96 Reputation points
2022-08-15T04:16:48.84+00:00

How i could debug a dll using visual studio? I have the DLL source, pdb, etc.

I tried these options:

231131-image.png

It launches the exe but doesn't inject the DLL, by default this exe didn't load the DLL, im manually injecting it.

Isnt possible to visual studio attach the DLL? whats that option for then?

Developer technologies Visual Studio Debugging
Developer technologies C++
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,461 Reputation points
    2022-08-15T08:05:48.863+00:00

    The Visual Studio debugger can attach to a process.

    Once a DLL is loaded into the process being debugged the debugger should be able to debug the loaded DLL assuming that its source code is available. Otherwise, you would have to use the Disassembly window.

    Exactly how are you "manually injecting" your DLL into the test.exe process? Maybe the process exits too quickly. One thing you can try is to use some code in the DLL to give you time to act. For example, the DLL could use a call to MessageBox() after it has been "injected". At that time you could do what you need to do before you dismiss the modal dialog. Or put some kind of a delay in test.exe.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.