MDAC 2.5 SDK - Technical Articles


 

ITrusteeGroupAdmin::GetMemberships

Gets the membership trustees to which a trustee belongs.

HRESULT GetMemberships ( 
   TRUSTEE *      pTrustee,
   ULONG *        pcMemberships,
   TRUSTEE **     prgMemberships
);

Parameters

pTrustee

[in]
Address of an initialized TRUSTEE structure that identifies the trustee whose memberships will be returned.

pcMemberships

[out]
Address of a ULONG variable that receives the number of TRUSTEE structures returned using prgMemberships.

prgMemberships

[out]
Address of a TRUSTEE pointer variable that receives the address of an array of TRUSTEE structures representing the membership trustees that have pTrustee as a member.

Return Code

S_OK

The membership trustees were successfully retrieved.

SEC_E_PERMISSIONDENIED

Requester does not have permissions for the operation.

SEC_E_BADTRUSTEEID

pTrustee did not point to a valid TRUSTEE structure.

SEC_E_NOTRUSTEEID

pTrustee was not a trustee for the current data source object.

E_INVALIDARG

pTrustee, pcMemberships, or prgMemberships was a null pointer.

E_FAIL

A provider-specific error occurred.

Comments

The provider calls CoTaskMemAlloc to allocate memory for the array of TRUSTEE structures that represent the membership trustees that have pTrustee as a member.

The consumer releases *prgMemberships when it no longer needs the TRUSTEE structures. Before freeing this memory, the consumer should free any memory allocated in the pMultipleTrustee or ptstrName elements of each structure. The consumer should call CoTaskMemFree for all these tasks.

If the trustee identified by pTrustee does not belong to any membership trustees or if an error occurs, the provider ensures that no memory is allocated for prgMemberships, sets *pcMemberships to zero, and sets *prgMemberships to NULL.

See Also

ITrusteeGroupAdmin, ITrusteeGroupAdmin::GetMembers, ITrusteeGroupAdmin::IsMember, TRUSTEE