To maximize performance, updates to the registry in Windows 8 and Windows Server 2012 are not immediately flushed to disk. Instead, the registry flushes modified registry data to the disk at regular intervals of time. In addition, modified registry data is saved to disk when the system shuts down. In most cases, these mechanisms are sufficient to ensure that registry modifications safely reach the disk.
Because registry changes are not immediately flushed to disk, if a machine loses power immediately after an application modifies the registry, the application’s registry changes may not be saved. If this occurs, the application may observe the following effects when the system restarts:
- Registry changes made by the application may not be visible - A newly installed driver may no longer appear to be installed, and will need to be reinstalled - A newly uninstalled driver will still be installed, and need to be uninstalled again
An application or installer can request that its registry modifications be written to disk immediately using the RegFlushKey API. However, calling RegFlushKey is an expensive operation that significantly affects system-wide performance. Applications and installers should only call this API if they must guarantee that their registry modifications are immediately persisted to disk.
As noted above, if a machine loses power immediately after an application modifies the registry, the application’s registry changes may not be saved. If Shutdown or Restart is initiated and they complete successfully, unsaved registry modifications are flushed to disk before the machine shuts down. The Sleep and Hibernate options are not guaranteed to flush unsaved registry modifications to disk, but if a machine successfully resumes from sleep or hibernate, any registry changes made prior to sleeping or hibernating will still be visible after resuming. To summarize, any action during Shutdown, Restart, Sleep or Hibernate that prevents the machine from resuming successfully can cause unsaved registry changes to not be saved.
The default "Power button action" is set to "Shutdown" on Windows systems to cause a shutdown to occur when the power button is pressed. If the "Power button action" is set to "Do nothing", pending disk writes are not saved.
The following links provide more information on this topic:
Windows Kernel event ID 41 error "The system has rebooted without cleanly shutting down first" in Windows 7 or Windows Server 2008 R2