What's New in Services for Windows 7

Windows 7 and Windows Server 2008 R2 include the following new and updated programming elements for services.

New Capabilities

A service can register to be started or stopped when a trigger event occurs. This eliminates the need for services to start when the system starts, or for services to poll or actively wait for an event; a service can start when it is needed, instead of starting automatically whether or not there is work to do. For more information, see Service Trigger Events.

Updated Functions

Function Description
ChangeServiceConfig
Changes the configuration parameters of a service. This function supports managed service accounts and virtual accounts. For more information, see Service Accounts Step-by-Step Guide.
ChangeServiceConfig2
Changes the optional configuration parameters of a service. This function supports new configuration information levels for processor groups and service trigger events.
CreateService
Creates a service object and adds it to the specified service control manager database. This function supports managed service accounts and virtual accounts. For more information, see Service Accounts Step-by-Step Guide.
HandlerEx
An application-defined callback function used with the RegisterServiceCtrlHandlerEx function. This callback function supports new extended control codes for system time changes and service trigger events.
QueryServiceConfig2
Retrieves the optional configuration parameters of a service. This function supports new configuration information levels for processor groups and service trigger events.
SetServiceStatus
Updates the service control manager's status information for the calling service. This function supports new extended control codes for system time changes and service trigger events.

New Structures

Structure Description
SERVICE_TIMECHANGE_INFO
Contains system time change settings.
SERVICE_TRIGGER
Represents a service trigger event.
SERVICE_TRIGGER_INFO
Contains trigger event information for a service.
SERVICE_TRIGGER_SPECIFIC_DATA_ITEM
Contains trigger-specific data for a service trigger event.