const
SM_CLEANBOOT = 67;
type
TWindowsBootMode = (
bmNormal = 0,
bmFailSafe = 1,
bmFailSafeWithNetwork = 2,
bmUnknow = 3
);
function GetSystemMetrics(nIndex: integer): integer; stdcall; external 'user32.dll' name 'GetSystemMetrics';
function GetWindowsBootMode: TWindowsBootMode;
var ret: integer;
begin
ret := GetSystemMetrics(SM_CLEANBOOT);
case ret of
0..2 : result := TWindowsBootMode(ret);
else
result := bmUnknow;
end;
end;
function WindowsBootModeToStr(const bm : TWindowsBootMode): string;
const
BTS : array[TWindowsBootMode] of string = ('Normal mode','Safe mode','Safe mode with network','Unknow');
begin
result := BTS[bm];
end;