Directory Services |
The DsMakePasswordCredentials function constructs a credential structure suitable for input to the DsBindWithCred function.
DWORD DsMakePasswordCredentials( LPCTSTR User, LPCTSTR Domain, LPCTSTR Password, RPC_AUTH_IDENTITY_HANDLE* pAuthIdentity );
Return Code | Description |
---|---|
ERROR_SUCCESS | The function was successful. |
ERROR_INVALID_PARAMETER | One or more parameters are invalid. |
ERROR_NOT_ENOUGH_MEMORY | A memory allocation failure occurred. |
STATUS_INVALID_PARAMETER | pAuthIdentity is invalid. |
A null, default credential may be created if none of the input parameters are present. 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 pAuthIdentitity is passed to DsBindWithCred, DsUnbind must be called before freeing the handle with DsFreePasswordCredentials. The normal sequence of events is:
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension
on Windows NT 4.0 SP6a and Windows 95/98/Me.
Unicode: Implemented as Unicode and ANSI versions on Windows
NT/2000/XP.
Header: Declared in Ntdsapi.h.
Library: Use Ntdsapi.lib.
DsBindWithCred, DsFreePasswordCredentials, DsUnbind, RPC_AUTH_IDENTITY_HANDLE, Domain Controller and Replication Management Functions