3.2.5.3.7 SAGetAccountInformation (Opnum 3)

The SAGetAccountInformation method MUST retrieve the account name for a specified task.

 HRESULT SAGetAccountInformation(
   [in, string, unique] SASEC_HANDLE Handle,
   [in, string] const wchar_t* pwszJobName,
   [in, range(0,MAX_BUFFER_SIZE)] DWORD ccBufferSize,
   [in, out, size_is(ccBufferSize)] 
     wchar_t wszBuffer[]
 );

Handle: Pointer to a Unicode string that MUST specify the server. The client MUST map this string to an RPC binding handle. The server MUST ignore this parameter. For more details, see [C706] sections 4.3.5 and 5.1.5.2.

pwszJobName: MUST be a pointer to a string that specifies a task name, such as "MyJob.job".

ccBufferSize: MUST contain the number of characters in the array supplied by the client and filled by the server. This value MUST be the size of the wszBuffer parameter. MAX_BUFFER_SIZE is equal to 273. For more information on MAX_BUFFER_SIZE, see the SaSec interface IDL (section 6.2).

wszBuffer: Upon input, MUST be an empty array of size equal to the ccBufferSize parameter. The client SHOULD initialize the array to contain zeroes. Upon return, the array MUST contain the name of the account to be used as the context the task runs under.

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 SAGetAccountInformation call, the server MUST:

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

  • Return SCHED_E_CANNOT_OPEN_TASK if the pwszJobName parameter is not a file name present in the .JOB task store.

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

  • Return SCHED_E_ACCOUNT_INFORMATION_NOT_SET if there is no mapping in the account name store for the task name; otherwise, get the account name from the mapping.

  • Return E_INVALIDARG if the wszBuffer parameter is NULL.

    Note When passing NULL as a value for this parameter, behavior can change based on the RPC Runtime Check. See RPC Runtime Check Notes (section 3.3).

  • If the account name is "LocalSystem", set wszBuffer to be the empty string and return S_OK.

  • Return the value 0x8007007A, which is the HRESULT form of the Win32 error ERROR_INSUFFICIENT_BUFFER, if the account name (including the terminating zero character) is larger than ccBufferSize.

  • Copy the null-terminated account name to wszBuffer and return S_OK.

If any errors are raised during the processing, they are returned. For more information about return codes, see section 2.3.14 and Win32 Error Codes in [MS-ERREF] section 2.1.