OEMWriteRegistry (Compact 2013)

10/16/2014

This function transfers registry data to persistent storage.

Syntax

BOOL OEMWriteRegistry ( 
  DWORD dwFlags, 
  LPBYTE lpBuf, 
  DWORD len 
);

Parameters

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

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

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

    OEMWriteRegistry retrieves the bytes and saves them in persistent storage.

  • len
    [in] Number of bytes in the buffer lpBuf.

    The OS sets the number to 0 (zero) when the end of the file has been reached.

Return Value

Returns true if successful; otherwise, returns false.

Remarks

You can only call this function from kernel mode.

Implement this function to support persistent storage of the registry. If you implement OEMWriteRegistry, set the pfnWriteRegistry member of OEMGLOBAL to point to this function.

When an application calls the RegFlushKey function, the OS is notified to flush the registry. The OS checks for a valid pfnWriteRegistry member. If pfnWriteRegistry is valid, the OS continues to call the OEMWriteRegistry function to send bytes to the OEM-implemented function until it returns false, indicating that an error occurred, or until the OS completes the flush.

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, len is not set to 0 (zero). If it is not set to 0 (zero) when this function is called, the function must return an error because the registry file is incomplete.

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

This function and the OEMReadRegistry function are supported only by the object store-based registry. To save and restore data in the hive-based registry, see the RegSaveKey and the RegReplaceKey functions.

The data file that this function saves cannot be imported directly by the function RegRestoreFile. Use RegCopyFile to save the data that RegRestoreFile restores, or use this function to save the data to be imported by OEMReadRegistry.

Requirements

Header

pkfuncs.h

Library

OEMMain.lib or OEMMain_StaticKITL.lib

See Also

Reference

Optional OAL Functions