Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Saving application registry changes on Windows 8 or Windows Server 2012


View products that this article applies to.

Summary

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.

↑ Back to the top


More Information

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

http://support.microsoft.com/kb/2028504

RegFlushKey function (Windows)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724867(v=vs.85).aspx

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2784761
Revision : 1
Created on : 1/7/2017
Published on : 11/28/2012
Exists online : False
Views : 374