Also der Benutzer der automatisch eingeloggt wird, sthet in der Registry:
Delphi-Quellcode:
function SetAutoLogin(const Machine, User, PW: string): LongInt;
var
MyReg : TMpuRegistry;
ret : LongInt;
begin
MyReg := TMpuRegistry.Create(Machine, HKEY_LOCAL_MACHINE);
try
with MyReg do
begin
ret := Connect;
if ret = 0 then
begin
ret :=
OpenKey('SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon',
KEY_WRITE);
if ret = 0 then
begin
WriteStringW('DefaultUsername', User);
WriteStringW('DefaultPassword', PW);
WriteStringW('AutoAdminLogon', '1');
end;
end;
end;
finally
MyReg.Free;
end;
result := ret;
end;