MDAC 2.5 SDK - Technical Articles


 

ISecurityInfo::GetCurrentTrustee

Returns the current trustee.

HRESULT GetCurrentTrustee ( 
   TRUSTEE **     ppTrustee
);

Parameters

ppTrustee

[out]
Address of a TRUSTEE pointer variable that receives the trustee information of the current user.

Return Code

S_OK

The current trustee was successfully retrieved.

SEC_E_PERMISSIONDENIED

Requester does not have permissions for the operation.

E_INVALIDARG

ppTrustee was a null pointer.

E_FAIL

A provider-specific error occurred.

Comments

The provider allocates memory for the TRUSTEE structure by calling CoTaskMemAlloc and returns the address of this memory in the *ppTrustee variable.

When the caller is finished with the structure, it is responsible for releasing the memory allocated. Before the caller releases the TRUSTEE structure, it should release the memory allocated in the ptstrName element. It is possible that the pTrustee element of each EXPLICIT_ACCESS structure refers to multiple trustees. If so, *pMultipleTrustee in the TRUSTEE structure will not be set to NULL. The caller traverses the linked list of TRUSTEE structures that start with the head *pMultipleTrustee element and releases them in reverse order. The caller should call CoTaskMemFree for all of these tasks.

If an error occurs, the provider does not allocate any memory and sets *ppTrustee to a null pointer.

See Also

ISecurityInfo, TRUSTEE