DRMGetUserInfo function (msdrm.h)

[The AD RMS SDK leveraging functionality exposed by

the client in Msdrm.dll is available for use in Windows Server 2008, Windows Vista, Windows Server 2008 R2, Windows 7, Windows Server 2012, and Windows 8. It may be altered or

unavailable in subsequent versions. Instead, use Active Directory Rights Management Services SDK 2.1,

which leverages functionality exposed by the client in Msipc.dll.]

The DRMGetUserInfo function obtains information about a user.

Syntax

DRMEXPORT HRESULT UDAPICALL DRMGetUserInfo(
  [in]      DRMPUBHANDLE hUser,
  [in, out] UINT         *puUserNameLength,
  [out]     PWSTR        wszUserName,
  [in, out] UINT         *puUserIdLength,
  [out]     PWSTR        wszUserId,
  [in, out] UINT         *puUserIdTypeLength,
  [out]     PWSTR        wszUserIdType
);

Parameters

[in] hUser

The handle of the user to obtain information for.

[in, out] puUserNameLength

A pointer to a UINT value that, on entry, contains the length, in characters, of the wszUserName buffer. This length must include the terminating null character.

After the function returns, this value contains the number of characters, including the terminating null character, that were copied to the wszUserName buffer.

[out] wszUserName

A pointer to a null-terminated Unicode string that receives the user name as a fully qualified SMTP email address. This is not enforced or used to check identities; it is only included to provide a human-readable identification. The size of this buffer is specified by the puUserNameLength parameter.

To determine the required size of this buffer, pass NULL for this parameter. The function will place the size, in characters, including the terminating null character, in the puUserNameLength value.

[in, out] puUserIdLength

A pointer to a UINT value that, on entry, contains the length, in characters, of the wszUserId buffer. This length must include the terminating null character.

After the function returns, this value contains the number of characters, including the terminating null character, that were copied to the wszUserId buffer.

[out] wszUserId

A pointer to a null-terminated Unicode string that receives the user's ID. The size of this buffer is specified by the puUserIdLength parameter.

To determine the required size of this buffer, pass NULL for this parameter. The function will place the size, in characters, including the terminating null character, in the puUserIdLength value.

[in, out] puUserIdTypeLength

A pointer to a UINT value that, on entry, contains the length, in characters, of the wszUserIdType buffer. This length must include the terminating null character.

After the function returns, this value contains the number of characters, including the terminating null character, that were copied to the wszUserIdType buffer.

[out] wszUserIdType

A pointer to a null-terminated Unicode string that receives the type of ID used to identify the user (such as Passport, Windows, or other). The size of this buffer is specified by the puUserIdTypeLength parameter.

To determine the required size of this buffer, pass NULL for this parameter. The function will place the size, in characters, including the terminating null character, in the puUserIdTypeLength value.

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following list. For a list of common error codes, see Common HRESULT Values.

Remarks

For more information about user IDs and ID types, see DRMCreateUser.

When you obtain the output values, you can first call this function with wszUserName, wszUserId, and wszUserIdType set to NULL to obtain the needed buffer sizes through puUserNameLength, puUserIdLength, and puUserIdTypeLength. It is the application's responsibility to allocate and free buffer space.

Requirements

Requirement Value
Target Platform Windows
Header msdrm.h
Library Msdrm.lib
DLL Msdrm.dll

See also

AD RMS Functions

DRMCreateUser

DRMGetUsers