ChangeAccountPasswordW function (sspi.h)

The ChangeAccountPassword function changes the password for a Windows domain account by using the specified Security Support Provider.

This function is supported only by the Microsoft Kerberos, Microsoft Negotiate, and Microsoft NTLM providers.

Syntax

SECURITY_STATUS SEC_ENTRY ChangeAccountPasswordW(
  [in]      SEC_WCHAR      *pszPackageName,
  [in]      SEC_WCHAR      *pszDomainName,
  [in]      SEC_WCHAR      *pszAccountName,
  [in]      SEC_WCHAR      *pszOldPassword,
  [in]      SEC_WCHAR      *pszNewPassword,
  [in]      BOOLEAN        bImpersonating,
  [in]      unsigned long  dwReserved,
  [in, out] PSecBufferDesc pOutput
);

Parameters

[in] pszPackageName

The name of the provider to use. The value of this parameter must be either "Kerberos", "Negotiate", or "NTLM".

[in] pszDomainName

The domain of the account for which to change the password.

[in] pszAccountName

The user name of the account for which to change the password.

[in] pszOldPassword

The old password to be changed.

[in] pszNewPassword

The new password for the specified account.

[in] bImpersonating

TRUE if the calling process is running as the client; otherwise, FALSE.

[in] dwReserved

Reserved. Must be set to zero.

[in, out] pOutput

On input, a pointer to a SecBufferDesc structure. The SecBufferDesc structure must contain a single buffer of type SECBUFFER_CHANGE_PASS_RESPONSE. On output, the pvBuffer member of that structure points to a DOMAIN_PASSWORD_INFORMATION structure.

Return value

If the function succeeds, the function returns SEC_E_OK.

If the function fails, it returns an error code.

Remarks

Note

The sspi.h header defines ChangeAccountPassword as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header sspi.h
Library Secur32.lib
DLL Secur32.dll