Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change Password API on NT Server
Message
 
À
23/08/1999 03:56:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00256474
Message ID:
00256572
Vues:
90
>Hi,
>
>Does anyone know if I can call a windows API to change the user login password in an NT server ? Thanks.

From the pages of the platform SDK (code for C++, but must be faily easily adaptable to VFP)

Hugo

NetUserChangePassword
The NetUserChangePassword function changes a user's password for a specified network server or domain.

Security Requirements
A server or domain can be configured to require a user to log on before changing the password on a user account. In that case, only members of the Administrators or Account Operators local group or the user himself can change the password for a user account. If logging on is not required, the user can change the password for any user account, as long as the user knows the current password.

Only available on NT though (Server or Workstation). If I'm not mistaken the DLL called should be advapi32.dll (for the declare statement, if it is like in VB).

Hugo

======================================

NET_API_STATUS NetUserChangePassword(
LPCWSTR domainname,
LPCWSTR username,
LPCWSTR oldpassword,
LPCWSTR newpassword
);
Parameters
domainname
[in] Pointer to a null-terminated Unicode string that specifies the name of a remote server or domain. The NetUserChangePassword function changes the user's password on that remote server or domain.
If this parameter is NULL, the logon domain of the caller is used.

username
[in] Pointer to a null-terminated Unicode string that specifies a user name. The NetUserChangePassword function changes the password for that user.
If this parameter is NULL, the logon name of the caller is used.

oldpassword
[in] Pointer to a null-terminated Unicode string that specifies the user's old password.
newpassword
[in] Pointer to a null-terminated Unicode string that specifies the user's new password.
Return Values
If the function is successful, it returns account information and the return value is NERR_Success.

If the function fails, the return value can be one of the following error codes.

Value Meaning
ERROR_ACCESS_DENIED The user does not have access to the requested information.
ERROR_INVALID_PASSWORD The user has entered an invalid password.
NERR_InvalidComputer The computer name is invalid.
NERR_NotPrimary The operation is allowed only on the primary domain controller of the domain.
NERR_UserNotFound The user name could not be found.
NERR_PasswordTooShort The password is shorter than required. The password could also have been too long, too recent in its change history, not enough unique characters, or some other faulty indication of password restrictions.
"My get up and go must've got up and went"
-Steve Tyler, Aerosmith
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform