Registriert seit: 26. Mai 2006
Ort: Arnsberg
588 Beiträge
Delphi 11 Alexandria
|
Re: Benutzerkennwort zurücksetzen
13. Jul 2008, 22:55
so gehts
Delphi-Quellcode:
Type
NetAPIStatus = Integer;
Function NetUserSetInfo(ServerName,UserName : PWideChar;Level : Integer;
Const Buf : Pointer; Var Parm_Err : DWORD) : NetAPIStatus; StdCall; External 'NETAPI32.DLL';
Function LM_NetUserSetServerPassword(Const Server,UserName,NewPassword : String) : Boolean;
Const
NERR_Success = 0;
LM20_PWLEN = 20;
Type
TUserInfo_1003 = Packed Record
Password : PWideChar;
end;
Var
BufServer : Array[0..63] Of WideChar;
BufUsername : Array[0..63] Of WideChar;
BufPassword : Array[0..LM20_PWLEN - 1] Of WideChar;
UI1003 : TUserInfo_1003;
Param_Err : DWORD;
Res : NetAPIStatus;
Begin
StringToWideChar(Server,BufServer,Length(BufServer));
StringToWideChar(Username,BufUsername,Length(BufUsername));
StringToWideChar(NewPassword,BufPassword,Length(BufPassword));
UI1003.Password:=@BufPassword;
Res:=NetUserSetInfo(BufServer,BufUsername,1003,@UI1003,Param_Err);
Result:=(Res = NERR_Success);
end;
Stefan Kubatzki E=mc2
|
|
Zitat
|