Use GetSystemMetrics( SM_CLEANBOOT ), here are some inline functions, you can understand what they do from their names…
__inline BOOL IsNormalBoot()
{
return ::GetSystemMetrics(SM_CLEANBOOT) == 0;
}
__inline BOOL IsSafeMode()
{
return ::GetSystemMetrics(SM_CLEANBOOT) == 1;
}
__inline BOOL IsSafeModeWithNetworkBoot()
{
return ::GetSystemMetrics(SM_CLEANBOOT) == 2;
}
