Platform SDK: Active Directory, ADSI, and Directory Services

DsMakePasswordCredentials

The DsMakePasswordCredentials function constructs a credential structure that is suitable for input to the DsBindWithCred function.

DWORD DsMakePasswordCredentials(
  LPTSTR User,
  LPTSTR Domain,
  LPTSTR Password,
  RPC_AUTH_IDENTITY_HANDLE *pAuthIdentity
);

Parameters

User
[in] Null-terminated string containing the user name.
Domain
[in] Null-terminated string containing the domain.
Password
[in] Null-terminated string containing the password.
pAuthIdentity
[out] Pointer to a variable that receives a handle to the credential structure. The returned structure must be deallocated using the DsFreePasswordCredentials function.

Return Values

If the function successfully creates a credential, the return value is ERROR_SUCCESS.

Remarks

A null, default credential may be created if none of the input parameters are present. Otherwise, User must be present. If Domain or Password are null, they default to empty strings (""). The Domain parameter may be null when User is fully qualified, such as a user in UPN format (for example, someone@microsoft.com).

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Ntdsapi.h.
  Library: Included as a resource in Ntdsapi.dll.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

DC and Replication Management Functions, DsBindWithCred, DsFreePasswordCredentials