3.2.5.4.18 SchRpcGetTaskInfo (Opnum 17)

The SchRpcGetTaskInfo method MUST return information about a specified task.

 HRESULT SchRpcGetTaskInfo(
   [in, string] const wchar_t* path,
   [in] DWORD flags,
   [out] DWORD* pEnabled,
   [out] DWORD* pState
 );

path: MUST contain the full path to a task using the format specified in section 2.3.11.

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

F S

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

Value

Description

FS

SCH_FLAG_STATE

If set to 1, the server MUST retrieve the TASK_STATE.

Undefined bits. MUST be set to zero when sent and MUST be ignored on receipt.

pEnabled: MUST be a pointer to a Boolean that indicates whether the task is currently enabled.

pState: If non-NULL and the SCH_FLAG_STATE bit in the flags parameter is set, the server MUST return the current state of the task in the format specified in section 2.3.13. Otherwise, the server MUST ignore this parameter.

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

Upon receipt of the SchRpcGetTaskInfo call, the server MUST:

  • Return E_INVALIDARG if the path parameter is NULL or is the root.

  • 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 the value 0x80070003, the HRESULT form of the Win32 error ERROR_PATH_NOT_FOUND, if the specified path does not exist on the server in the XML task store.

  • Return the HRESULT form of the Win32 error ERROR_FILE_NOT_FOUND if the specified task does not exist on the server in the XML task store.

  • Return E_ACCESSDENIED if the caller does not have read access to the task.

If the pEnabled parameter is non-NULL, the server MUST set the corresponding memory location to the value of the enabled/disabled flag in the task store.

  • If the pState parameter is non-NULL and the SCH_FLAG_STATE bit is set in the flags parameter, return a state value (section 2.3.13) specified as follows:

    • If the task has any entries in the running task list in the TASK_STATE_RUNNING state, return TASK_STATE_RUNNING.

    • Otherwise, if the task has any entries in the running task list in the TASK_STATE_QUEUED state, return TASK_STATE_QUEUED.

    • Otherwise, if the task is enabled in the task store, return TASK_STATE_READY.

    • Otherwise, return TASK_STATE_DISABLED.

  • Return S_OK.