3.1.4.2.5 Retrieve Task Status

First, the client MUST know the task's name. The client either created the name when adding the task (section 3.1.4.2.2), obtained the name by enumerating tasks (section 3.1.4.2.6), or obtained the name by other out-of-band means.

Next, the client MUST determine the task folder on the server (see section 3.1.4.2.1.1).

Next, the client MUST read the .JOB file from the task folder on the server, using the task name as the name of the file. If the file is not a valid .JOB file (section 2.4), the client MUST return an error to the application. Otherwise, the client MUST extract the desired status information from the .JOB file.<42>

Finally, if the application requests the account name associated with the task, the client MUST allocate an array of WCHAR's to receive the account name (the array SHOULD be initialized to contain all zeroes) and then MUST invoke the SAGetAccountInformation method with the following parameter values: the task name in the pwszJobName parameter, the size of the array in WCHAR's in the ccBufferSize parameter, and a pointer to the array in the wszBuffer parameter.