Use Windows API GetSystemMetrics with sm_cleanboot parameter, this specifies how the system was started, in Your Project's code Use:
PROGRAM Project1;
Uses
Forms,
Windows,
Dialogs,
Unit1 in 'unit1.pas' {form1};
{$ R * .res}
Begin
Application.INITIALIZE;
Application.createform (TFORM1, FORM1);
Case getSystemMetrics (sm_cleanboot) of
1: Begin
ShowMessage ('Running in Safe Mode: Fail-Safe Boot');
Application.Terminate;
END;
2: Begin
ShowMessage ('Running in Safe Mode: Fail-Safe With Network Boot');
Application.Terminate;
END;
END;
Application.run;
End.