3.2.5.4.9 SchRpcEnumInstances (Opnum 8)

The SchRpcEnumInstances method MUST return a task's list of instances that are currently running.

 HRESULT SchRpcEnumInstances(
   [in, string, unique] const wchar_t* path,
   [in] DWORD flags,
   [out] DWORD* pcGuids,
   [out, size_is(, *pcGuids)] GUID** pGuids
 );

path: MUST contain the full path to a task in the format specified in section 2.3.11. If NULL is specified, all instances for all tasks MUST be returned.

flags: The flags field MUST contain individual bit flags that MUST have one or more of the following values:


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

H

Value

Description

H

TASK_ENUM_HIDDEN

If set to 1, hidden tasks MUST be included in the result set.

The client MUST set undefined bits to 0. The server MUST return an error if any of the undefined bits are not set to 0.

pcGuids: MUST contain the number of instances.

pGuids: MUST be an array of GUIDs.

Return Values: For more information on return codes, see section 2.3.14, or Win32 Error Codes in [MS-ERREF] section 2.1.

Upon receipt of the SchRpcEnumInstances call, the server MUST:

  • Return E_INVALIDARG if any bit other than TASK_ENUM_HIDDEN is set in the flags parameter.

  • Return 0x8007007B, the HRESULT form of the Win32 error ERROR_INVALID_NAME if the specified path is not in the format specified in section 2.3.11.

  • Return 0x80070002, the HRESULT form of the Win32 error ERROR_FILE_NOT_FOUND if the task specified in the path parameter does not exist on the server or the file specified by the path parameter does not exist in the XML task store.<73>

  • Enumerate all of the running task instances in the running task list conceptual data structure. If the path parameter is not NULL, the server MUST skip all entries in the running task list whose locations do not match the path parameter. The server MUST skip all entries for tasks to which the caller does not have read access. Unless the TASK_ENUM_HIDDEN bit is set in the flags parameter, the server MUST skip all entries for hidden tasks (section 2.5.4.12).

  • Return an array of task instance IDs from the enumerated running task instances in the pGuids parameter.

  • Return the number of task instance IDs in the pcGuids parameter.

  • Return S_OK.