應用層和驅動如何判斷當前的啟動模式

cnbragon發表於2013-07-15

1. 應用層

呼叫

int nBootType = GetSystemMetrics(SM_CLEANBOOT)

MSDN解釋:

The value that specifies how the system is started:         

  • 0 Normal boot
  • 1 Fail-safe boot
  • 2 Fail-safe with network boot

A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files.

值為0表示正常模式,1表示安全模式,2表示帶網路連線的安全模式

 

2. 驅動層

 

需要

extern PULONG InitSafeBootMode

引用時需要加*號

*InitSafeBootMode

值為0表示正常啟動,

#define SAFEBOOT_MINIMAL                1
#define SAFEBOOT_NETWORK             2
#define SAFEBOOT_DSREPAIR             3

 

相關文章