Home > Windows API > Get my system’s boot mode, or is my system booted in safe mode?

Get my system’s boot mode, or is my system booted in safe mode?

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;
}
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: