How to set breakpoint at the very beginning of program execution

后端 未结 7 1182
眼角桃花
眼角桃花 2020-11-29 08:37

How can I stop the program before loading any of the linked DLLs?

I\'ve tried to set LoadLibraryExW function in the Break At Function debug

7条回答
  •  一整个雨季
    2020-11-29 09:39

    You can do this by adding a registry key to "Image File Execution Options" with the name of your exe. Add a value of type string named "Debugger" and set it to vsjitdebugger.exe to launch the just-in-time debugger dialog. Which then lets you pick one of the available debuggers, including Visual Studio. This dialog is triggered right after Windows has loaded the EXE, before any code starts running.

    Here's is a sample .reg file that triggers the dialog when you start notepad.exe. Modify the key name to your .exe:

    REGEDIT4
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
    "Debugger"="vsjitdebugger.exe"
    

提交回复
热议问题