(Gast)
n/a Beiträge
|
Re: Herausfinden ob PW zu dem Benutzerkonto passt
27. Sep 2005, 16:26
Oder für lokale Accounts (keine Ahnung ob es mit ADS funktioniert)
Delphi-Quellcode:
(** )
type
NET_API_STATUS = Integer;
function NetUserChangePassword(domainname, username, oldpassword,
newpassword: LPCWSTR): NET_API_STATUS;
stdcall; external 'netapi32.dll';
(**)
function VerifyUserPassword(const UserName, Password: WideString): DWORD;
var
// make sure it's the same pointer...
Buffer: array [0..1023] of WideChar;
begin
lstrcpynW(Buffer, PWideChar(Password), SizeOf(Buffer) div SizeOf(WideChar));
Result := DWORD(
NetUserChangePassword(nil, PWideChar(UserName), Buffer, Buffer));
end;
////////////////////////////////////////////////////////////////////////////////
// Test
procedure Test;
begin
ShowMessage(SysErrorMessage(
VerifyUserPassword('root', 'LittlePigLittlePigLetMeIn...')
));
end;
|
|
Zitat
|