How to set a breakpoint in an injected function?

May 15, 2009 at 12:14 PM


I am using RemoteHooking.CreateAndInject() to inject a library to an arbitrary process.

How can I set a breakpoint inside an injected function?  The injected function is in the process space of that arbitrary process.




May 15, 2009 at 9:15 PM

Simply attaching a debugger to the "arbitrary process" should work.

Ben Schwehn

May 16, 2009 at 5:38 AM


I tried but when setting the breakpoint in VS2005, it says "The breakpoint will not currently be hit. No symbols have been loaded for this document."

Here are the detailed steps:

1. Run the program in a command prompt:

ManagedTest.exe c:\windows\notepad.exe

The Notepad window is shown.

2. Start VS2005,open the ManagedTest project

3. Select "Debug" -> "Attach to process", and select the notepad.exe process

4. Set the breakpoint, and the "The breakpoint will not currently be hit..." tooltip is shown

I also copied the ManagedTest.pdb to c:\windows (where the notepad.exe is), but it didn't help.


Please kindly help.