Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

The RegFlushKeyfunction has two different behaviors, depending on the type of registry on the device. You determine which of the following registry types to use:

Note:
Windows Mobile does not support RAM-based registry.
  • RAM-based registry

    If an application calls RegFlushKey, the OS attempts to flush the entire registry to the supported storage. The implementation of this function is OEM-dependent, which results in the following scenarios:

    • If you do not support persistent registry storage, a call to this function fails.

    • If you support persistent registry storage, a call to this function flushes the entire registry for storage.

    • If your flush request fails, RegFlushKeyfails.

  • Hive-based registry

    If an application calls RegFlushKey, the OS attempts to flush any changed data in the hive to the file beneath it. The particular hive to flush is determined from the specified key.

By default, Windows Mobile does not support a lazy flush of the registry. The PRJ_ENABLE_REGFLUSH_THREAD environment variable can be set to force the OS to automatically lazy flush the registry. Windows phones that need to implement a lazy flush or power-down flush can also do so by calling RegFlushKeyat any time from a shell, from a low-priority thread, or in the power-off switch handler in the keyboard driver.

Note:
Calling this function excessively can negatively impact the performance of an application.

See Also

Concepts

Registry Flushing
Registry Operations

Other Resources