Share via


Creating a Task Object

In order to perform a task, one or more COM objects must be implemented. Each of these task objects must implement the IApplianceTask interface as described in the appliancetask.idl file. These task objects are registered and their PROGIDs are listed in the TaskExecutables value for the registry entry of this task. This registry entry is described in the Task Definition Elements section of the Adding a Task to the Appliance Manager topic. Task objects are executed in the order that they are listed.

The following functions must also be implemented in order to perform a task: lApplianceTask::OnTaskComplete, lTaskContext::SaveParameters, lTaskContext::RestoreParameters, lTaskContext::Clone, and lTaskContext::RemoveParameter. The developer also needs to look at the chime sample application for an example on how to create a task object.

Web property, tabbed property, and wizard pages call the ExecuteTask function, in the context of SA_ExecuteTask (TaskName, bExecuteAsync,TaskContext). Set TaskName to the task name as entered in the registry and bExecuteAsync the flag indicating whether the task should be executing asynchronously. These functions set up the task context object with the correct name value pairs by using the hidden form values collected in the task. A task can check the task context object to get return results from the server appliance tasks.

The task coordinator reads the registry to get the list of task objects for a given task name. The task coordinator invokes each task object by calling the IApplianceTask::OnTaskExecute method and then passes a handle to the task context object. Each object calls the ITaskContext::GetParameters method to get input parameters passed down from the task by using the handle passed by the task coordinator. The task objects call the ITaskContext::SetParameters method to send return values back to the task. The ITaskContext interface is specified in the taskctx.idl file.

To debug server appliance tasks, it is helpful to isolate problems in the front-end task from the back-end task COM objects.

Adding a Web Task

Adding a Task to the Appliance Manager

Adding Task Objects to the Appliance Initialization Task

Adding Task Objects to the Every Boot Task

Adding Task Objects to the First Boot Task

Adding Task Objects to the Reset Configuration Task

Adding Task Objects to the Second Boot Task

Chime Sample Application