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 Performance Validator into the application.
•Loads the Performance Validator stub DLL into the application
•Configures the NT Service API to communicate to Performance Validator
•Does some work that can be monitored by Performance Validator
•Exits
For implementation details see attachToPerformanceValidator(); in serviceChildProcess.cpp.
The application will need to link to the NT Service API, for example ..\..\..\svlPVStubService\release_2010_x64\svlPVStubService_x64.lib (for a release x64 EXE/DLL).
Important. Call attachToPerformanceValidator() as close to the start of your application as possible, before any threads have been created.
Read more about working with NT Services.