Share via


WriteRegistryToOEM

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/27/2008

This function is called by the operating system to transfer registry data to persistent storage. WriteRegistryToOEM is defined by the OEM. This function is callable from kernel mode only.

Syntax

BOOL WriteRegistryToOEM( 
  DWORD dwFlags, 
  LPBYTE lpData, 
  DWORD cbData 
);

Parameters

  • dwFlags
    [in] Read options specified by the system.

    Currently, the only flag is REG_WRITE_BYTES_START, which indicates the start of the new registry file.

  • lpData
    [in] Pointer to a buffer allocated by the OS and filled with registry bytes.

    The WriteRegistryToOEM function retrieves the bytes and saves them in persistent storage.

  • cbData
    [in] Number of bytes in the buffer lpData passed in by the OS.

    When set to zero, the end of file has been reached.

Return Value

If this function succeeds, it returns TRUE.

If this function fails, it returns FALSE.

Remarks

The OS exposes the pWriteRegistryToOEM global pointer that is available in the OAL. To support persistent storage of the registry, implement the WriteRegistryToOEM function and assign the address of the function to pWriteRegistryToOEM.

When the OS is instructed to flush the registry, the OS checks for a valid pWriteRegistryToOEM. If pWriteRegistryToOEM is valid, the OS continues to call this function to send bytes to the OEM implemented function until it returns FALSE, indicating that an error occurred, or the OS completes the flush.

The registry is notified that it needs to be flushed when the RegFlushKey function is called by an application.

Only a fully saved registry can be restored; attempting to restore a partial registry produces unpredictable results. If you try to save a partial registry, cbData is not set to zero. Then, when WriteRegistryToOEM is called, an error should be returned because the registry file is incomplete.

If you implement this function, document its support for your specific target device. Because the data format used by this function is different than the format used by the function RegCopyFile, the data cannot be exchanged.

The WriteRegistryToOEM and ReadRegistryFromOEM mechanism is only supported by the object store-based registry. To save and restore data in the hive-based registry, see the RegSaveKey and RegReplaceKey functions.

The data file saved by WriteRegistryToOEM cannot be imported directly by the function RegRestoreFile. Use RegCopyFile to save the data to be restored by RegRestoreFile, or use WriteRegistryToOEM to save the data to be imported by ReadRegistryFromOEM.

Requirements

Header pkfuncs.h
Library Nk.lib
Windows Embedded CE Windows CE 2.10 and later

See Also

Reference

pWriteRegistryToOEM
ReadRegistryFromOEM

Other Resources

Kernel Mode APIs
RegFlushKey
RegSaveKey
RegReplaceKey
RegCopyFile
RegRestoreFile