Please enable JavaScript to view this site.

Performance Validator Help

Navigation: Working with IIS and Services

Example Service Source Code

Scroll Prev Top Next More

 

Where to put your code

 

When you use the functions to load and unload Performance Validator from your service, it is important that you put the function calls in the correct place in your software.

 

The correct place to put them is in a 'balanced' location, such that you would expect no memory leaks to occur between the load and the unload function call, assuming the service was working correctly.

 

Typically, this means that Performance Validator is:

 

loaded as the first action in the service_main() function
 

unloaded just before the service control manager is informed of the stopped status
 

The source code shown below shows an example service_main() function used in a service, demonstrating where to load and unload Performance Validator.

 

The long comment covers problems with the way services are stopped and what may be displayed in a debugger if this happens.

 

seeAlsoThe code is extracted from service\service.cpp, part of the full example of an NT service, client and a utility for controlling whether the service uses Performance Validator.