This pair of projects create an application that is launched from a service.
The purpose of this example is to show how to monitor the application that is launched from the service. This is also the same process for monitoring an application launched by an application launched from a service.
This process is subtly different to the method for working with services (see the example service for that).
The service project is serviceWithAChildProcess.vcxproj
The following tasks are performed when the service is started:
•the test application is launched from the service
The application project is serviceChildProcess.vcxproj
The application's first task is to load Thread Validator into the application.
•Loads the Thread Validator stub DLL into the application
•Configures the NT Service API to communicate to Thread Validator
•Does some work that can be monitored by Thread Validator
•Exits
For implementation details see attachToThreadValidator(); in serviceChildProcess.cpp.
The application will need to link to the NT Service API, for example ..\..\..\svlTVStubService\release_2010_x64\svlTVStubService_x64.lib (for a release x64 EXE/DLL).
Important. Call attachToThreadValidator() as close to the start of your application as possible, before any threads have been created.
Read more about working with NT Services.