System Delphi

procedure TForm1.Button1Click(Sender: TObject);
begin
case GetSystemMetrics(SM_CLEANBOOT) of
1: begin
ShowMessage('Running in Safe Mode: Fail-Safe Boot');
end;
2: begin
ShowMessage('Running in Safe Mode: Fail-safe with network boot');
end;
end;
end;