Nondeterministic Registry Flushing (Windows CE 5.0)
The RegFlushKey function has two different behaviors, varying with the type of registry in use on the device. You determine which of the following registry types to use:
Object store-based registry
If an application calls RegFlushKey, the operating system attempts to flush the entire registry to the Windows CE-based device supported storage. The implementation of this function is OEM-dependent, which results in the following scenarios:
- If you do not support persistent registry storage, then a call to this function fails.
- If you support persistent registry storage, then a call to this function flushes the entire registry to you for storage.
- If your flush request fails, then RegFlushKey fails.
For more information about supporting a persistent registry, see Persisting Data with the RAM-Based Registry.
Hive-based registry
If an application calls RegFlushKey, the operating system attempts to flush any changed data in the hive to the file underneath it. The particular hive to flush is determined from the key provided.
Applications can call RegFlushKey on the system hive or the user hive. The implementation of this function is not OEM-dependent.
For more information about the way data is saved, see Persisting Data with the Hive-Based Registry.
By default, Windows CE does not support a lazy flush of the registry. The PRJ_ENABLE_REGFLUSH_THREAD environment variable can be set to force the operating system to automatically lazy flush the registry. Windows CE-based devices that need to implement a lazy-flush or power-down flush can also do so by calling RegFlushKey at 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
Advanced Registry Concepts | Flush-On-Close Registry Flushing | Registry | Hive-Based Registry Stored in RAM
Send Feedback on this topic to the authors