0

HI,

How to Debug Windows Service written in VC++ in VS2008 ?

Any help is appreciated.

bits
  • 7,480
  • 7
  • 43
  • 54
Swapnil Gupta
  • 7,915
  • 14
  • 50
  • 75

2 Answers2

0

You can use:

  • DebugBreak() to break your code whereever you want. or
  • Debug Flags utility that comes as a part of Windbg Installer to break as soon as a particular process starts.
bits
  • 7,480
  • 7
  • 43
  • 54
  • Also checkout [another similar question](http://stackoverflow.com/questions/125964/easier-way-to-start-debugging-a-windows-service-in-c). – bits Mar 01 '11 at 05:46
  • But these all are in C# , I want in VC++. DebugBreak is only breaking the code i want to debug the Service code – Swapnil Gupta Mar 01 '11 at 05:51
  • @Swapnil ok, I didn't notice the other question was in c#. But both the options that I mentioned will work for any Windows based c++ code. Once your service process breaks, why can't you debug it? All you need to do is then supply your debug symbols and start debugging. – bits Mar 01 '11 at 05:54
0

I've previously written up a number of debugging tips for Windows services in C++ here: Convert a C++ program to a Windows service?

Community
  • 1
  • 1
the_mandrill
  • 27,460
  • 4
  • 58
  • 90