OSR Dev Blog

How to Determine if System Running in Safe Mode
(By: Hector J. Rodriquez | Published: 02-Jun-04| Modified: 07-Jun-04)

Since the introduction of Windows 2000, many driver developers have asked if there is a way to determine whether or not the system is running in Safe Mode, and if it is, exactly what type of Safe Mode it is in.    Well, a recent KB article entitled "How to determine whether the system is running in Safe Mode from a device driver" found at http://support.microsoft.com/default.aspx?scid=kb;EN-US;837643 explains it all.  

Essentially the way it works is that your driver must import the InitSafeBootMode variable using the following declaration:

extern PULONG InitSafeBootMode;

This variable has 4 possible values:

  • - The system is not in safe mode
  • 3 - SAFEBOOT_DSREPAIR (for Windows Domain Controllers Only)

Anyway, this KB article applies to all Windows 2000,XP, and Server 2003 system.

This article was printed from OSR Online http://www.osronline.com

Copyright 2017 OSR Open Systems Resources, Inc.