This topic has not yet been rated - Rate this topic

DsMakePasswordCredentials function

The DsMakePasswordCredentials function constructs a credential handle suitable for use with the DsBindWithCred function.

Syntax


DWORD DsMakePasswordCredentials(
  _In_   LPCTSTR User,
  _In_   LPCTSTR Domain,
  _In_   LPCTSTR Password,
  _Out_  RPC_AUTH_IDENTITY_HANDLE *pAuthIdentity
);

Parameters

User [in]

Pointer to a null-terminated string that contains the user name to use for the credentials.

Domain [in]

Pointer to a null-terminated string that contains the domain that the user is a member of.

Password [in]

Pointer to a null-terminated string that contains the password to use for the credentials.

pAuthIdentity [out]

Pointer to an RPC_AUTH_IDENTITY_HANDLE value that receives the credential handle. This handle is used in a subsequent call to DsBindWithCred. This handle must be freed with the DsFreePasswordCredentials function when it is no longer required.

Return value

Returns a Windows error code, including the following.

Return codeDescription
ERROR_SUCCESS

The function succeeded.

ERROR_INVALID_PARAMETER

User is invalid.

ERROR_NOT_ENOUGH_MEMORY

A memory allocation failure occurred.

STATUS_INVALID_PARAMETER

pAuthIdentity is invalid.

 

Remarks

A null, default credential handle is created if User, Domain and Password are all NULL. Otherwise, User must be present. The Domain parameter may be NULL when User is fully qualified, such as a user in UPN format; for example, "someone@fabrikam.com".

When the handle returned in pAuthIdentity is passed to DsBindWithCred, DsUnBind must be called before freeing the handle with DsFreePasswordCredentials. The normal sequence is:

  1. Call DsMakePasswordCredentials to obtain the credential handle.
  2. Call DsBindWithCred, and pass the credential handle.
  3. Call DsUnbind when the binding is no longer required.
  4. Call DsFreePasswordCredentials to free the credential handle.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Redistributable

Active Directory Client Extension on Windows NT 4.0 and Windows Me/98/95

Header

Ntdsapi.h

Library

Ntdsapi.lib

DLL

Ntdsapi.dll

Unicode and ANSI names

DsMakePasswordCredentialsW (Unicode) and DsMakePasswordCredentialsA (ANSI)

See also

DsBindWithCred
DsFreePasswordCredentials
DsUnbind
RPC_AUTH_IDENTITY_HANDLE
Domain Controller and Replication Management Functions

 

 

Send comments about this topic to Microsoft

Build date: 10/26/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.