Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I add breakpoint on CreateProcess in VS

Can I add breakpoint on windows CreateProcess API in Visual studio like I can do in Windbg?

like image 796
anand Avatar asked Jul 15 '09 11:07

anand


1 Answers

Yes - Go "Debug / New breakpoint / Break at function..." and paste this:

{,,kernel32.dll}_CreateProcessW@40

into the Function box.

That assumes a Unicode build - replace W with A for ANSI builds.

A bit of explanation: the @40 piece is part of the stdcall calling convention, and gives the number of bytes of parameters that the function takes. In win32, this is almost always 4 times the number of parameters. The underscore is also part of the stdcall calling convention.

A related note: sometimes the name of the function as seen by the debugger is different from its real name - see this blog post for an example, and how to find the right name to use: Setting a Visual Studio breakpoint on a Win32 API function in user32.dll

like image 80
RichieHindle Avatar answered Oct 19 '22 05:10

RichieHindle