DsBindWithCredA function

The DsBindWithCred function binds to a domain controller using the specified credentials.

Syntax

NTDSAPI DWORD DsBindWithCredA(
  LPCSTR                   DomainControllerName,
  LPCSTR                   DnsDomainName,
  RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
  HANDLE                   *phDS
);

Parameters

DomainControllerName

Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind. For more information about this parameter, see the DomainControllerName description in the DsBind topic.

DnsDomainName

Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind to. For more information about this parameter, see the DnsDomainName description in the DsBind topic.

This parameter is required to secure a Kerberos authentication.

AuthIdentity

Contains an RPC_AUTH_IDENTITY_HANDLE value that represents the credentials to be used for the bind. The

DsMakePasswordCredentialsfunction is used to obtain this value. If this parameter is NULL, the credentials of the calling thread are used.

DsUnBind must be called before freeing this handle with the DsFreePasswordCredentials function.

phDS

Address of a HANDLE value that receives the binding handle. To close this handle, pass it to the DsUnBind function.

Return Value

Returns ERROR_SUCCESS if successful or a Windows or RPC error code otherwise. The following are the most common error codes.

Requirements

   
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header ntdsapi.h
Library Ntdsapi.lib
DLL Ntdsapi.dll

See Also

DOMAIN_CONTROLLER_INFO

Domain Controller and Replication Management Functions

DsBind

DsFreePasswordCredentials

DsGetDcName

DsMakePasswordCredentials

DsUnBind

Mutual Authentication Using Kerberos