次の方法で共有


RegFlushKey (Compact 2013)

3/26/2014

This function writes all the attributes of an open registry key into the registry.

Syntax

LONG RegFlushKey( 
  HKEY hKey 
);

Parameters

  • hKey
    [in] Handle to a currently open key or one of the following predefined reserved handle values:

    • HKEY_CLASSES_ROOT
    • HKEY_CURRENT_USER
    • HKEY_LOCAL_MACHINE
    • HKEY_USERS

Return Value

ERROR_SUCCESS indicates success. A nonzero error code indicates failure. To get a generic description of the error, call the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag set.

Remarks

When this function is called, all previous changes to the registry are saved by flushing data to persistent storage. The implementation of this function is OEM-dependent. This function can also write out parts of or all of the other registry keys.

By default, Windows Embedded Compact does not support a lazy flush of the registry in which registry changes are saved at regular intervals, although the OEM can implement a lazy flush or power-down flush.

Applications must call this function to save important registry information, but only when they require certainty that registry changes are saved.

Important

Calling this function excessively can have a negative effect on application performance.

If your OS design supports a Hive-based registry (SYSGEN_FSREGHIVE), RegFlushKey uses filesys to flush the updated registry data to the storage hive file. If your OS design supports a RAM-based registry (SYSGEN_FSREGRAM), RegFlushKey flushes the updated registry data to either Oemregistry,dll, if present, or calls the OEM-implemented function WriteRegistryToOEM.

If you have installed Premium Shared Source, for more information, see InternalRegFlushKey in %_WINCEROOT%\private\winceos\COREOS\filesys\Reg\Reghive\Registry.c and %_WINCEROOT%\private\winceos\COREOS\filesys\reg\regobj\Registry.c.

In Platform Builder for Windows Embedded Compact 2013, to test an application that uses RegFlushKey to save registry changes to persistent storage after you reset the target device, you must clear the Clear memory on soft reset box in Target Device Connectivity Options: Core Service Settings.

Requirements

Header

winreg.h

Library

coredll.dll

See Also

Reference

Registry Functions
RegCloseKey
RegDeleteKey

Other Resources

FormatMessage